98.7% Of all customers recommend us, we're so confident about our results we publish all reviews and stats
View Live Stats View ReviewsForum home » Delegate support and help forum » Microsoft Excel VBA Training and help » Issues with my macros produced in 2003, cant use in 2007?
Issues with my macros produced in 2003, cant use in 2007?
Resolved · Urgent Priority · Version 2007
Khurram has attended:
Access Intermediate course
Issues with my macros produced in 2003, cant use in 2007?
Hi there,
having issues with my macros that were produced on excel 2003, my company has now upgraded to 2007 and they dont seem to work?
Scratching my head, we have a toolpak - vba added and tried changing the file names in the macro from xls to xlsx with nio success.
is there anything i could do, alternatively could i send you a copy of the code i am working from.
Sub UpdateFromBondRec()
'ChDir "'G:\Operations\Control\Bond Trading"
'Workbooks.Open filename:= _
"G:\Operations\Control\Bond Trading\Bond & FRS Rec - January 2008.xlsx", Notify _
:=False
Dim ws As Worksheet
Dim workDate As Date
Set ws = ActiveWorkbook.Sheets("CDS")
workDate = ws.Range("a2").Value
OpenExcelFile "Bond & FRS Rec - " & Format(workDate, "mmmm yyyy") & ".xlsx", _
"G:\Operations\Control\Bond Trading\Bond & FRS Rec - " & Format(workDate, "mmmm yyyy") & ".xlsx"
SearchBondRec "Bond & FRS Rec - " & Format(workDate, "mmmm yyyy") & ".xlsx", "CCY Amounts", "EUR", "LOFA", _
"LOFA - " & Format(workDate, "mmm yyyy") & ".xlsx", "EUR", workDate
SearchBondRec "Bond & FRS Rec - " & Format(workDate, "mmmm yyyy") & ".xlsx", "CCY Amounts", "USD", "LOFA", _
"LOFA - " & Format(workDate, "mmm yyyy") & ".xlsx", "USD", workDate
End Sub
Sub OpenExcelFile(ExcelFileName, ExceFilePathAndName As String)
Dim wb As Workbook
Dim str As String
Dim wbs As Workbooks
Dim i As Boolean
Set wbs = Application.Workbooks
i = False
For Each wb In wbs
If ExcelFileName = wb.Name Then
i = True
End If
Next 'wb
If i = False Then
Workbooks.Open Filename:= _
ExceFilePathAndName, UpdateLinks:=False, Notify _
:=False
End If
End Sub
Sub TestSearchBondRec()
Dim workDate As Date
workDate = DateValue("16/10/2006")
SearchBondRec "Bond & FRS Rec - " & Format(workDate, "mmmm yyyy") & ".xls", "CCY Amounts", "AUD", "LOFA", _
"LOFA" & Format(workDate, "mmm yyyy") & _
".xls", "AUD", workDate
End Sub
Sub SearchBondRec(CopyFromFile, CopyFromSheet, CCY, BondBook, PasteToWB, PasteToWS As String, _
workDate As Date)
Dim refrange As Range
Dim r, c As Integer
Dim ws As Worksheet
Workbooks(CopyFromFile).Activate
Sheets(CopyFromSheet).Activate
'Set ws = Sheets("CCY Amounts")
ActiveSheet.PivotTables("PivotTable3").PivotFields("PRFC").CurrentPage = BondBook
ActiveSheet.PivotTables("PivotTable3").PivotFields("CCY").CurrentPage = CCY
Cells.Find(What:=Format(workDate, "d-mmm-yy"), After:=Range("a1"), LookIn:=xlValues, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
Set refrange = ActiveCell.Offset(1, 0)
r = refrange.Row
c = refrange.Column
Range(Cells(r, c), Cells(157, c)).Select
Application.CutCopyMode = False
Selection.Copy
Workbooks(PasteToWB).Activate
Sheets(PasteToWS).Select
Cells.Find(What:=Format(workDate, "d-mmm-yy"), After:=Range("a1"), LookIn:=xlValues, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
ActiveCell.Offset(1, 0).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
End Sub
RE: issues with my macros produced in 2003, cant use in 2007?
Hi Khurram
Thank you for your post and the supplied code. We have had a review of this and think that a solution is within reach albeit one that is beyond the ability of this forum.
We would need around half a day working with your files to identify and solve the issues you are facing. This would be treated as consutlancy work and we will clearly identify what work is required and associated costs for you to decide on.
If you would like to investigate this further please let us know.
Kind regards
Jacob
RE: issues with my macros produced in 2003, cant use in 2007?
Hi Jacob,
Not realy interested in any further consultancy work. I thought your forum maybe able to give me a simpler solution. Or atleast point me in the right direction.
RE: issues with my macros produced in 2003, cant use in 2007?
Hi Khurram
Appreciate your situation we would need half a day to really pick through your working files and so a quick pointer is not really achievable in this context.
Regards
Jacob
RE: issues with my macros produced in 2003, cant use in 2007?
Hello Khurram
I see you post is from a few months ago and you no-doubt have found a solution by now.
If not, did you try changing the files to .xlsm.
This solved a similar problem for me.
Kind regards
Ziggy
Mon 17 May 2010: Automatically marked as resolved.
Training information:
Welcome. Please choose your application (eg. Excel) and then post your question. Our Microsoft Qualified trainers will then respond within 24 hours (working days). Frequently Asked Questions
Any suggestions, questions or comments? Please post in the Improve the forum thread. |
Excel tip:Page Break Preview in Excel 2010 (Hint/tip)If you select View then Workbook Views then Page Break Preview, you will be able to view how your Excel spreadsheet will be split across multiple pages when printed. Even better, you can also drag a page break to a new place. Excel will then scale down your entire worksheet to fit the information you want on the pages you want. |