Exchanging variable values between applications 
Author Message
 Exchanging variable values between applications

G'day,

I am using MS Project 98, Office 2000 and Windows 2000
Professional.

I have written a Project application that opens Excel and
gets it to open a text file (downloaded from an SAP
mainframe) and process the data before copying and pasting
it back to Project.

I want to assign a value to a variable in Project via an
input box, then send that value to Excel. I want to use
the value as part of the filename to be retrieved in Excel.

When I assign a value to a variable in Project, how do I
then refer to that variable (or retrieve its value) in
Excel? Declaring a variable as Public makes it available
in that project, but not in another application.

Hoping someone can point me in the right direction.

Thanks,

Dave.



Fri, 11 Mar 2005 09:29:09 GMT  
 Exchanging variable values between applications
Hi David,

When you run the Excel instructions and the Excel.application object from
Project VBA, you DO HAVE acces to the public variables in your Excel
instructions - I fail to see the problem

If you call a native Excel routine by the Run command you haven't.
What I would do in such a case is to open Excel in Project, write the data
to a Workbook, and read that in your Excel application.

But the best thing to do is to open Excel from within Project and to use
Public vaiables: they do work.

HTH
Jan



Quote:
> G'day,

> I am using MS Project 98, Office 2000 and Windows 2000
> Professional.

> I have written a Project application that opens Excel and
> gets it to open a text file (downloaded from an SAP
> mainframe) and process the data before copying and pasting
> it back to Project.

> I want to assign a value to a variable in Project via an
> input box, then send that value to Excel. I want to use
> the value as part of the filename to be retrieved in Excel.

> When I assign a value to a variable in Project, how do I
> then refer to that variable (or retrieve its value) in
> Excel? Declaring a variable as Public makes it available
> in that project, but not in another application.

> Hoping someone can point me in the right direction.

> Thanks,

> Dave.



Fri, 11 Mar 2005 17:02:01 GMT  
 Exchanging variable values between applications
Hi,

In Project you can save anything you want to any Excel cell. Any Excel VBA
macro can then read the cell. I recommend naming a cell in Excel, that way
if someone adds or removes a row or column, the macro continues to work. For
example if a cell is named FilePath, then in Project

xlApp.Range("FilePath")=PathNameVariable

In an Excel macro:
xlBooks.Open FileName:=Range("FilePath")

--

Visit www.mvps.org/project/ for the Project MVP's FAQ and third party
add-ons

Rod Gill
Microsoft Project MVP
Visit www.projectlearning.com for customized Project and Office VBA macros
and Project companion software


Quote:
> G'day,

> I am using MS Project 98, Office 2000 and Windows 2000
> Professional.

> I have written a Project application that opens Excel and
> gets it to open a text file (downloaded from an SAP
> mainframe) and process the data before copying and pasting
> it back to Project.

> I want to assign a value to a variable in Project via an
> input box, then send that value to Excel. I want to use
> the value as part of the filename to be retrieved in Excel.

> When I assign a value to a variable in Project, how do I
> then refer to that variable (or retrieve its value) in
> Excel? Declaring a variable as Public makes it available
> in that project, but not in another application.

> Hoping someone can point me in the right direction.

> Thanks,

> Dave.



Fri, 11 Mar 2005 12:06:11 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Assigning values to Application scope variables from a recordset fails

2. Change Value of Application Variable directly from VB 6

3. The value of a variable (String type) is the name of a variable

4. Variable Name to Variable value.

5. Create a Variable from the value of another variable

6. Getting data values to CR from variable arrays and stand alone variables in VB

7. Variable values as variable names

8. Assigning the value to the value of a variable

9. Assigning Client Script Variables to Application level variables inside of a Client Script

10. Variable exchange between window with vbscript

11. 2-way variable exchange in a procedure.

12. Word 97 - Userform within Word VBA macro and exchange of values

 

 
Powered by phpBB® Forum Software