Auto_Open Code on Worksheet
I receive an Excel workbook that runs an Auto_Open routine not from VBA, but
from a worksheet named "Macro1" with each of the macros defined as names in the workbook (see sample below). Access 2007 will not let me import the worksheet with this Auto_Open routine. Can anyone point me in a direction to disable this Auto_Open macro in Excel? The Auto_Open is in column B, while the other 21 macros are in column A. Auto_Open =ERROR(2,Recover) =WORKBOOK.SELECT("Data Sheet 1") =WINDOW.RESTORE() =WINDOW.SIZE(82.5,42.75) =WORKBOOK.HIDE("Macro1",TRUE) =EDIT.COLOR(1,0,0,0) =RUN("Macro20") =DELETE.NAME("Auto_Open") =WORKBOOK.SELECT("Data sheet 1") =SELECT("R3:R65536") =SELECT("R1C1") =WINDOW.MAXIMIZE() =RETURN() |
Auto_Open Code on Worksheet
You need to open the workbook in readonly mode. try this code
Sub Openbook() filetoopen = Application _ .GetOpenFilename("Excel Files (*.xls), *.xls") Workbook.Open Filename:=filetoopen, ReadOnly:=True End Sub "Tony" wrote: I receive an Excel workbook that runs an Auto_Open routine not from VBA, but from a worksheet named "Macro1" with each of the macros defined as names in the workbook (see sample below). Access 2007 will not let me import the worksheet with this Auto_Open routine. Can anyone point me in a direction to disable this Auto_Open macro in Excel? The Auto_Open is in column B, while the other 21 macros are in column A. Auto_Open =ERROR(2,Recover) =WORKBOOK.SELECT("Data Sheet 1") =WINDOW.RESTORE() =WINDOW.SIZE(82.5,42.75) =WORKBOOK.HIDE("Macro1",TRUE) =EDIT.COLOR(1,0,0,0) =RUN("Macro20") =DELETE.NAME("Auto_Open") =WORKBOOK.SELECT("Data sheet 1") =SELECT("R3:R65536") =SELECT("R1C1") =WINDOW.MAXIMIZE() =RETURN() |
Auto_Open Code on Worksheet
Great! This forum is the first stop when I'm trying to resolve an issue with
Excel VBA and the community never fails to let me down! Thank you very much. "Joel" wrote: You need to open the workbook in readonly mode. try this code Sub Openbook() filetoopen = Application _ .GetOpenFilename("Excel Files (*.xls), *.xls") Workbook.Open Filename:=filetoopen, ReadOnly:=True End Sub "Tony" wrote: I receive an Excel workbook that runs an Auto_Open routine not from VBA, but from a worksheet named "Macro1" with each of the macros defined as names in the workbook (see sample below). Access 2007 will not let me import the worksheet with this Auto_Open routine. Can anyone point me in a direction to disable this Auto_Open macro in Excel? The Auto_Open is in column B, while the other 21 macros are in column A. Auto_Open =ERROR(2,Recover) =WORKBOOK.SELECT("Data Sheet 1") =WINDOW.RESTORE() =WINDOW.SIZE(82.5,42.75) =WORKBOOK.HIDE("Macro1",TRUE) =EDIT.COLOR(1,0,0,0) =RUN("Macro20") =DELETE.NAME("Auto_Open") =WORKBOOK.SELECT("Data sheet 1") =SELECT("R3:R65536") =SELECT("R1C1") =WINDOW.MAXIMIZE() =RETURN() |
All times are GMT +1. The time now is 10:00 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com