Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Charles
 
Posts: n/a
Default Disable VBA code execution when loading a workbook

How do I control the execution of the VBA Code in a spread sheet when I first
load the workbook.
I would like a dialog box to ask if I want to execute the code or not whenI
open the workbook?
Can any one suggest a way to do that???
--
CharlesM
  #2   Report Post  
Anne Troy
 
Posts: n/a
Default

Set your macro security to medium.
*******************
~Anne Troy

www.OfficeArticles.com


"Charles" wrote in message
...
How do I control the execution of the VBA Code in a spread sheet when I

first
load the workbook.
I would like a dialog box to ask if I want to execute the code or not

whenI
open the workbook?
Can any one suggest a way to do that???
--
CharlesM



  #3   Report Post  
Earl Kiosterud
 
Posts: n/a
Default

Charles,

You could use a flag. In module ThisWorkbook:

Private Sub Workbook_Open()
If MsgBox("Do you want to run the macros?", vbYesNo, "Hey") = vbYes Then
MacRun = True
End Sub

Now in your macros you can test this switch to determine whether to do stuff
or not

In a general module

Public MacRun as Boolean ' This line must be before any subs,
' (and only in one module).

Sub whatever()
If not MacRun then exit sub
..
' your macro code
..
End sub
--
Earl Kiosterud
www.smokeylake.com

"Charles" wrote in message
...
How do I control the execution of the VBA Code in a spread sheet when I
first
load the workbook.
I would like a dialog box to ask if I want to execute the code or not
whenI
open the workbook?
Can any one suggest a way to do that???
--
CharlesM



  #4   Report Post  
AusTexRich
 
Posts: n/a
Default

Security was at medium. Re-set to lowest and the same thing is happening.
--
AusTexRich


"Anne Troy" wrote:

Set your macro security to medium.
*******************
~Anne Troy

www.OfficeArticles.com


"Charles" wrote in message
...
How do I control the execution of the VBA Code in a spread sheet when I

first
load the workbook.
I would like a dialog box to ask if I want to execute the code or not

whenI
open the workbook?
Can any one suggest a way to do that???
--
CharlesM




  #5   Report Post  
AusTexRich
 
Posts: n/a
Default

Thanks. I'll make good use of the code.
--
AusTexRich


"Earl Kiosterud" wrote:

Charles,

You could use a flag. In module ThisWorkbook:

Private Sub Workbook_Open()
If MsgBox("Do you want to run the macros?", vbYesNo, "Hey") = vbYes Then
MacRun = True
End Sub

Now in your macros you can test this switch to determine whether to do stuff
or not

In a general module

Public MacRun as Boolean ' This line must be before any subs,
' (and only in one module).

Sub whatever()
If not MacRun then exit sub
..
' your macro code
..
End sub
--
Earl Kiosterud
www.smokeylake.com

"Charles" wrote in message
...
How do I control the execution of the VBA Code in a spread sheet when I
first
load the workbook.
I would like a dialog box to ask if I want to execute the code or not
whenI
open the workbook?
Can any one suggest a way to do that???
--
CharlesM




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
Change case...help please Terry Excel Worksheet Functions 14 October 2nd 05 12:29 PM
Using other workbooks.. DavidMunday Excel Worksheet Functions 2 July 1st 05 07:35 AM
Make Change Case in Excel a format rather than formula Kevin Excel Worksheet Functions 1 March 18th 05 08:53 PM
Often-Used Code not working in a new Workbook Steve Excel Discussion (Misc queries) 2 December 16th 04 11:55 PM
Stubborn toolbars in Excel 007 Excel Discussion (Misc queries) 9 December 11th 04 02:02 PM


All times are GMT +1. The time now is 08:28 AM.

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"