Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro Compatibility
I have a macro created in Excel 97/Windows 98. The macro
formats a document (font, size, margins, etc.) then allows for a save as a .pdf. We have recently upgraded to Excel 2002/Windows XP and now the macro will not run. The error it gives says the font is not compatible. Courier New is the font. Rumor is that macros created in older versions will not run on 2002 with XP. Does anyone know anything about this? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro Compatibility
I don't have xl2002 handy, but the Font part of your code works OK in xl2000
as well. Excel 2002 added finer granularity in controlling what is allowed when a sheet is protected. Perhaps, unless specifically allowed, changing the font is no longer allowed. Did you try doing it manually with the sheet protected? I suspect this has more to do with a change in the way Excel itself operates than anything to do with macro differences. Move you Protect line of code below the formatting instructions and you should be good to go if the sheet isn't already protected. -- Regards, Tom Ogilvy "M.Vance" wrote in message ... I checked the Tools=References and it looks the same. Here is the error I get when I try to run it then the line of code it highlights when I debug. Run time error'1004': Unable to set the Name property of the Font class. Error that is highlighted: .Name = "Courier New" Here is the macro also: Cells.Select ActiveSheet.Protect DrawingObjects:=False, Contents:=True, Scenarios:=True With Selection.Font .Name = "Courier New" .Size = 8 .Strikethrough = False .Superscript = False .Subscript = False .OutlineFont = False .Shadow = False .Underline = xlUnderlineStyleNone .ColorIndex = xlAutomatic End With Rows("9:9").Select ActiveWindow.FreezePanes = True ' Columns("A:A").Select ' Selection.Columns.AutoFit ' Range("A1:A8").Select ' With Selection.Interior ' .ColorIndex = 15 ' .Pattern = xlSolid ' End With With ActiveSheet.PageSetup .PrintTitleRows = "$1:$8" .PrintTitleColumns = "" End With ActiveSheet.PageSetup.PrintArea = "" With ActiveSheet.PageSetup .LeftHeader = "" .CenterHeader = "" .RightHeader = "" .LeftFooter = " Printed Copies For Reference Only" .CenterFooter = "Page &P of &N" .RightFooter = " &d &t" .LeftMargin = Application.InchesToPoints(0) .RightMargin = Application.InchesToPoints(0) .TopMargin = Application.InchesToPoints(1) .BottomMargin = Application.InchesToPoints(1) .HeaderMargin = Application.InchesToPoints(0.5) .FooterMargin = Application.InchesToPoints(0.5) .PrintHeadings = False .PrintGridlines = False .PrintComments = xlPrintNoComments Rem .PrintQuality = 600 .CenterHorizontally = True .CenterVertically = False .Orientation = xlLandscape .Draft = False .PaperSize = xlPaperLetter .FirstPageNumber = xlAutomatic .Order = xlDownThenOver .BlackAndWhite = False .Zoom = 100 End With End Sub Thanks -----Original Message----- Macros should run fine. After the error, go into the VBE and look in Tools=References (with your workbook as the active project) and see if any reference is marked as MISSING. If so, that means that excel can't find that reference. Select it and browse for the latest version or unselect it if you are not using it in your program. This is just a guess as to the cause. If you are using an addin from Adobe, then this could be causing the problem - I can't say. But most macros written in xl97 (using only built in VBA/Excel methods, procedures and functions) should work without modification in xl2002. -- Regards, Tom Ogilvy "M.Vance" wrote in message ... I have a macro created in Excel 97/Windows 98. The macro formats a document (font, size, margins, etc.) then allows for a save as a .pdf. We have recently upgraded to Excel 2002/Windows XP and now the macro will not run. The error it gives says the font is not compatible. Courier New is the font. Rumor is that macros created in older versions will not run on 2002 with XP. Does anyone know anything about this? . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Compatibility | Links and Linking in Excel | |||
COMPATIBILITY | Excel Discussion (Misc queries) | |||
Testing Reverse Compatibility and Compatibility in General | Excel Discussion (Misc queries) | |||
Compatibility | Excel Discussion (Misc queries) | |||
URGENT Mac/PC macro compatibility problem | Excel Discussion (Misc queries) |