How to Reference Global Variable for external application.

A

ajcross123

I have two workbooks. I want workbook A to set global module variables
in workbook B and direct B by calling its subroutines.

Currently, workbook B sets the global variables with its Forms. The
routines read the data files using the global variables.

Andy Cross
 
A

ajcross123

Tom said:
create a reference in Workbook A to workbook B.


huh?!? how do I do that?

In VBA, I see this
VBAProject (WorkbookA)
+Microsoft Excel Objects
+Modules
+Module1
VBAProject (WorkbookB)
+Microsoft Excel Objects
+Modules
+Module2

In Module2 has this global and this routine:
Public filename As String

Public Sub importFile
Dim f as File

End Su
 
M

Myrna Larson

In the VB Editor, go to the Tools menu, select References, and put a check
mark in front of the 2nd workbook (I believe it has to be open at this point).


Tom said:
create a reference in Workbook A to workbook B.


huh?!? how do I do that?

In VBA, I see this
VBAProject (WorkbookA)
+Microsoft Excel Objects
+Modules
+Module1
VBAProject (WorkbookB)
+Microsoft Excel Objects
+Modules
+Module2

In Module2 has this global and this routine:
Public filename As String

Public Sub importFile
Dim f as File

End Sub
 
A

ajcross123

Hmm, now I am not getting by this error which doesn't give me a clue a
to what is conflicting:

Name conflicts with existing module, project or object library.

I tried renaming obvious conflicts. All that I can think of is tha
both have "ThisWorkbook".

On a different tack, I added routines to the other sheet. These ar
executed with Application.Run and these can set that workbook'
variables and call its subroutines.

Thank you, though.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top