|
-
Feb 1st, 2006, 05:57 AM
#1
Thread Starter
Hyperactive Member
Disable macro's in opening Excelsheet
Is there any way to open an Excelsheet in code without enabeling the macro's?
Dim WB as WorkBook
Set WB = Application.Workbooks.Open("filename.xls")
-
Feb 1st, 2006, 08:33 AM
#2
Addicted Member
Re: Disable macro's in opening Excelsheet
take a look at the automationsecurity property
should be something like
VB Code:
Application.AutomationSecurity = msoAutomationSecurityForceDisable
-
Feb 1st, 2006, 09:30 AM
#3
Re: Disable macro's in opening Excelsheet
Well you could also set the security to "very high"
-
Feb 1st, 2006, 09:40 AM
#4
Addicted Member
Re: Disable macro's in opening Excelsheet
True, but if he does that, I think he won't be able to run the macro that opens his new workbook...
-
Feb 1st, 2006, 10:14 AM
#5
Re: Disable macro's in opening Excelsheet
That is the problem indeed.
-
Feb 2nd, 2006, 05:11 AM
#6
Thread Starter
Hyperactive Member
Re: Disable macro's in opening Excelsheet
msoAutomationSecurityForceDisable is a 2003 thing
And I ain't got 2003.
By the way, I don't need the macro's in the sheet.
The problem is, if I open the sheet witch contains macro's, the macro from which I open the sheet stops immediately after opening the sheet.
Got it?
-
Feb 2nd, 2006, 10:12 AM
#7
Addicted Member
Re: Disable macro's in opening Excelsheet
 Originally Posted by HWijngaarD
By the way, I don't need the macro's in the sheet.
If you don't need the macro at all, why don't you just delete it.
And if you need it for further uses, place them in a module.
I don't think you can disable macro for only one sheet, you disbale it for the whole workbook. So this is why you got this problem:
 Originally Posted by HWijngaarD
The problem is, if I open the sheet witch contains macro's, the macro from which I open the sheet stops immediately after opening the sheet.
-
Feb 2nd, 2006, 10:15 AM
#8
Re: Disable macro's in opening Excelsheet
IF all of these are Event Macro, like Worksheet_Change(ByVal Target As Range), etc.
The you can disable them by calling "Application.EnableEvents = False"
Make sure you turn events back on when your done.
Declan
Don't forget to mark your Thread as resolved.
Take a moment to rate posts that you think are helpful 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|