Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 313
Default 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()

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default 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()

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 313
Default 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()

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Addin Auto_Open code executes only in debug mode Matthew Pfluger Excel Programming 2 August 26th 08 09:58 PM
Auto_open from Worksheet Object Code Stuart[_2_] Excel Programming 1 October 19th 07 08:00 PM
Sub Auto_Open() - Sheet name - error code [email protected] Excel Programming 9 September 12th 06 01:18 PM
Need Code to Set Scaling Zoom in PageSetup in Auto_Open Sub Phil Hageman[_3_] Excel Programming 3 April 20th 04 09:11 PM


All times are GMT +1. The time now is 09:51 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"