Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel 2003 - Open File / Suppress Macros 1

Status
Not open for further replies.

SHardy

Programmer
May 9, 2001
231
GB
When opening an Excel 2003 file via VBA, is there a way to tell it to open with macros disabled?

Disabling via Excel's options is not an option for various reasons.

Thank you
 
->Disabling via Excel's options is not an option for various reasons.

Off the top of my head I can think of two suggestions, but they are both 'via Excel's options'. What is it that you have tried and rejected?

[tt]_____
[blue]-John[/blue][/tt]

Help us help you. Please read FAQ181-2886 before posting.
 
I have not tried anything yet. This is not something that I recall ever having to do previously.

What I am currently trying to do:

Create a new Dataport in MS Navision to import data from a user selected workbook. However, the workbooks contain autoexec macros that open a form. Navision cannot do it's bit with the form(s) open. I therefore need to specify (from Navision code) not to run the macros. If I know how to do this in VBA then I should be able to translate to Navision.

Therefore open to any suggestions? I have had a brief look in Excel VBA help, but did not find anything.

Thanks
 


What is it -- you don't want users to be able to run macros?

What application are you running when your VBA is running?

Skip,

[glasses] [red]Be Advised![/red]
The band of elderly oriental musicians, known as Ground Cover, is, in reality...
Asian Jasmine![tongue]
 
If you are using VBA then

application.enableevents = false
'open workbook etc
application.enableevents = true
'close workbook

should work...

Rgds, Geoff

We could learn a lot from crayons. Some are sharp, some are pretty and some are dull. Some have weird names and all are different colours but they all live in the same box.

Please read FAQ222-2244 before you ask a question
 
Skip,

It is not a case of what users can/ can't do. The file is being opened by other app, read then closed. However, macro causes file to open with modal form displayed and workbook hidden. This prevents reading of the file without manual intervention.

The app running the VBA is Microsoft Navision.

Geoff,

Thanks. I shall see if this can be applied by Navision.
 
Geoff,

That did the job nicely. Thank you.

I should've known that really, but I'm a bit rusty on Excel.

Regards,
Simon
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top