XL98: Warning Appears When You Use GetObject to Open WorkbookLast reviewed: March 18, 1998Article ID: Q182719 |
The information in this article applies to:
SYMPTOMSIf you run a Microsoft Visual Basic for Applications macro that uses the GetObject method to open a Microsoft Excel workbook, you may receive the following error message:
The workbook you are opening contains macros. Some macros may contain harmful viruses. If you are sure this workbook is from a trusted source, click Yes. If you are not sure and want to prevent any macros from running, click No.The macro pauses until you click Yes, No, or Cancel. Note that if the macro is designed to run unattended, this behavior may cause a problem.
CAUSEYou may receive this error message when the following conditions are true:
WORKAROUNDTo prevent this problem from occurring, disable Macro Virus Protection in Microsoft Excel 98 Macintosh Edition. Note that making Macro Virus Protection unavailable makes it possible (although unlikely) for a macro virus to infect your Microsoft Excel workbooks. To make Macro Virus Protection unavailable in Microsoft Excel 98 Macintosh Edition, follow these steps:
MORE INFORMATIONIn Microsoft Excel 98 Macintosh Edition, the Macro Virus Protection feature is designed to prevent macro viruses, such as the ExcelMacro/Laroux virus, from running. If you select the Macro Virus Protection check box, you are prompted to enable or disable macros whenever you open a workbook that contains macros. If you use the GetObject method of Automation to open a Microsoft Excel workbook that contains macros, and if Macro Virus Protection is available, you receive a warning message when you open the workbook. Example: If you make Macro Virus Protection available in Microsoft Excel 98 Macintosh Edition, and the workbook "Test" contains any macros, you receive the error message when you run the following sample Sub procedure:
Sub TestOLEAutomation() ' Dimension variables. Dim xlWkbk As Object ' The error message appears when this line is executed. Set xlWkbk = GetObject("Macintosh HD:Test") ' Display the program and document windows, and then close the ' workbook. xlWkbk.Parent.Visible = True xlWkbk.Parent.Windows(xlWkbk.Name).Visible = True xlWkbk.Close SaveChanges:=True Set xlWkbk = Nothing End Sub |
Additional query words: XL98
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |