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: 2
Default Use of global between workbooks

Hi

I have a set of workbooks that are normally used by users. I also run some
code from another workbook to collect data from these other workbooks. When
this happens I do not want some of the code in the user workbooks to run.

I set up a public variable in a standard module in the collecting workbook,
and set it to a value before opening the workbooks I am collecting the data
from. No matter what I do (having read many Q&A from this discussion group),
the code in the user workbook will not accept the line referring to the
public variable.

Some sample code (not the working code as now I am just trying to get a
string out in msgbox) is below.
in data collection workbook
[qoute]
Option Explicit
Option Compare Text
Public collationWB As String ' used to identify this workbook
Public collectingData As String

Sub collectData()
collectingData = "some words of hope"
[unquote]

and in user workbook (again this is just current failing example)
[quote]
Private Sub Workbook_Open()
'If Workbooks("unitCompletion.xls").collectingData Then
MsgBox Workbooks("unitCompletion.xls").CollectCode.collec tingData
[unquote]
As you can tell, this is in ThisWorkbook module

Any help appreciated.
 
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
group workbooks/files to make global changes? MikeR-Oz New Users to Excel 1 September 12th 08 11:21 PM
Excel global setting for all workbooks? Calculation Automatic Ben Excel Discussion (Misc queries) 1 April 19th 07 04:27 PM
How do I perform a global change within/across Excel workbooks? wilytdbear Excel Discussion (Misc queries) 2 July 25th 06 05:02 PM
Global Setting For All Workbooks - Filename In Footer TOMB Excel Worksheet Functions 3 April 4th 05 06:53 PM
Do the Addins belong to a workbook, or are they global to all workbooks loaded? Chip Pearson Excel Programming 3 August 6th 03 11:01 PM


All times are GMT +1. The time now is 02:05 AM.

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"