Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > Beginning VB 6
|
Beginning VB 6 For coders who are new to Visual Basic, working in VB version 6 (not .NET).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning VB 6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 6th, 2008, 01:35 AM
Authorized User
 
Join Date: Jan 2008
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default on opening workbook, how to disable macro ?

how can i disable my spreadsheet to stop executing macros when i open the worksheet ?

like the security notice will popup, asking me if i want to include macros or not....i click yes, and macros execute immediately....


even tho i put

 Workbook_Open()

'clear all formula fields

end sub

isn't that supposed to make sure no formula gets filled in, and that no macros execute ?

 
Old January 7th, 2008, 05:05 AM
Friend of Wrox
 
Join Date: Sep 2005
Posts: 812
Thanks: 1
Thanked 53 Times in 49 Posts
Default

You can try the following:

Sub Security()
    Dim secAutomation As MsoAutomationSecurity

    secAutomation = Application.AutomationSecurity

    Application.AutomationSecurity = msoAutomationSecurityForceDisable

    Workbooks.Open "c:\temp.xls"

    Application.AutomationSecurity = secAutomation

End Sub

http://www.dotnetdud.blogspot.com

VBA Tips & Tricks (http://www.vbadud.blogspot.com)





Similar Threads
Thread Thread Starter Forum Replies Last Post
Possible to run macro from another workbook? rmilward Excel VBA 2 September 26th, 2009 08:00 PM
Generate A Workbook With Macro Included robnot Excel VBA 1 February 16th, 2007 07:08 PM
Disable "Update Remote Reference" for a workbook desperado1306 Excel VBA 2 June 6th, 2006 11:24 AM
personal macro workbook helmekki Excel VBA 0 May 31st, 2004 03:11 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.