PC Review


Reply
Thread Tools Rate Thread

Auto_Open Code on Worksheet

 
 
Tony
Guest
Posts: n/a
 
      29th May 2009
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 With Quote
 
 
 
 
Joel
Guest
Posts: n/a
 
      29th May 2009
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 With Quote
 
Tony
Guest
Posts: n/a
 
      29th May 2009
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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Auto_open from Worksheet Object Code Stuart Microsoft Excel Programming 1 19th Oct 2007 08:00 PM
Sub Auto_Open() - Sheet name - error code transferxxx@gmail.com Microsoft Excel Programming 9 12th Sep 2006 01:18 PM
Auto_Open Select Worksheet =?Utf-8?B?UGhpbCBI?= Microsoft Excel Programming 2 27th Jun 2006 10:49 AM
Disabling Auto_Open in distributed worksheet =?Utf-8?B?RGF2ZUY=?= Microsoft Excel Programming 1 17th Jun 2006 09:52 PM
Need Code to Set Scaling Zoom in PageSetup in Auto_Open Sub =?Utf-8?B?UGhpbCBIYWdlbWFu?= Microsoft Excel Programming 3 20th Apr 2004 09:11 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:36 AM.