Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Refer to Public Variable from Another Workbook
I am workbook Other.xls, running a macro in module2. I wish to refer to a
public variable in wb1.xls, module1 called pubvar. I am doing things in the wb1.xls file with the macro and need to set the value of a public variable there so I can turn off some error checking that the file is performing. How is this done?` |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Refer to Public Variable from Another Workbook
Figured it out:
Windows("wb1.xls").Activate With Selection Processingon = 1 End With "Mike H." wrote: I am workbook Other.xls, running a macro in module2. I wish to refer to a public variable in wb1.xls, module1 called pubvar. I am doing things in the wb1.xls file with the macro and need to set the value of a public variable there so I can turn off some error checking that the file is performing. How is this done?` |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Refer to Public Variable from Another Workbook
unless you're running the code in wb1.xls, module1, and have already
set the value of the variable within the code, and then the macro in wb1.xls calls a macro in other.xls module2, you can't do it. because the variable is only set during the time the macro is running - it's not a tangible constant. if you want to use it that way, it'll have to be a physical entry in a cell in wb1.xls (could be hidden) that can be checked. when you run the macro in wb1.xls it could enter the variable into that cell. the cell would stay constant until the macro is run again. hth susan On Dec 11, 2:41 pm, Mike H. wrote: I am workbook Other.xls, running a macro in module2. I wish to refer to a public variable in wb1.xls, module1 called pubvar. I am doing things in the wb1.xls file with the macro and need to set the value of a public variable there so I can turn off some error checking that the file is performing. How is this done?` |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Refer to Public Variable from Another Workbook
what you are explaining as a solution doesn't seem to be what you
asked. here you're setting the variable, not reading it. but the variable is located in other.xls, not wb1.xls. i guess i misunderstood what you wanted. you can only set a variable inside the macro that is running. but you probably already knew that. :) susan On Dec 11, 3:22 pm, Mike H. wrote: Figured it out: Windows("wb1.xls").Activate With Selection Processingon = 1 End With "Mike H." wrote: I am workbook Other.xls, running a macro in module2. I wish to refer to a public variable in wb1.xls, module1 called pubvar. I am doing things in the wb1.xls file with the macro and need to set the value of a public variable there so I can turn off some error checking that the file is performing. How is this done?`- Hide quoted text - - Show quoted text - |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Public Variable | Excel Programming | |||
Public variable | Excel Programming | |||
Public Const to refer to a range name | Excel Programming | |||
Public variable | New Users to Excel | |||
public variable | Excel Programming |