Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 471
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 471
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,117
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,117
Default 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
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
Public Variable Marvin Excel Programming 1 March 29th 07 09:50 PM
Public variable Eric[_35_] Excel Programming 7 March 18th 07 06:54 AM
Public Const to refer to a range name TimT Excel Programming 1 August 23rd 06 08:14 PM
Public variable Jack New Users to Excel 4 March 18th 06 09:35 PM
public variable marwan hefnawy Excel Programming 1 September 5th 03 08:54 AM


All times are GMT +1. The time now is 04:29 PM.

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"