LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 111
Default Urgently need VB Help - Declaring "Global" Variable?

I have an active x Control in File A ... when you click on it it runs the
following "Sheet1" Excel Object Macro:

Option Explicit
Public MyMacroType As String


Public Sub StartCleanMRICkAccount_Click() Dim MyStartFile


MyStartFile = InputBox("What is the name of the file to run macro on? IE
Book1")
Windows(MyStartFile & ".xls").Activate

MyMacroType = "AddAccountNumbers"
Application.Run "CleanMRIExport"

Application.Calculation = xlCalculationAutomatic End Sub

As you see the above macro sets the value for the variable MyMacroType....
Then run the Maco "CleanMRIExport" which is located in the same file but in
Module11. The last step in the "CleanMRIExport" is to run a second Macro
called "addformula" the last step in this maco is below:

If MyMacroType = "NoAccountNumbers" Then

Application.Calculation = xlCalculationAutomatic


MsgBox "Report Completed"

Exit Sub
Else

Application.Run "AddAccountingNumbers"

End If


Every time I run all of this when I get to the above code my variable
"MyMacroType" is always empty. I have tried running it with the:

Option Explicit
Public MyMacroType As String

In just the "Sheet1" Excel Object and I have tried running it with it also
at the top of Module11 but still can keep the variable to hold the necessary
value.

PS: there are actually 2 different Active X controls macros that starts the
ride one sets the MyMacroType to "NoAccountNumbers" and the other Sets it to
"Add Accounting Numbers"

Am I trying to do the impossible or do I just need to make each Active X
control run different macro's when the first 50 steps are the exact same?

Sorry for such a long write up....
April
 
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
"Global" change Pivot Value field settings watkincm Excel Worksheet Functions 1 April 21st 09 12:07 AM
How do I stop "global" hyperlinks changing to "local" links? Em Excel Worksheet Functions 2 August 26th 08 01:18 PM
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM
"Type mismatch" when I try to fill an Array variable with "+" [email protected] Excel Discussion (Misc queries) 1 April 17th 07 01:28 PM
reading variable "from" and "to" ZIP codes Dan Wasser[_2_] Excel Programming 2 January 9th 04 01:36 PM


All times are GMT +1. The time now is 08:07 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"