Help - Module Execution in another program 
Author Message
 Help - Module Execution in another program

I'm not sure if anyone can help, but I would like to create a module within
MS Access 2000 that will execute some code within MS Project 2000.  I have
already created the code that will open the MS Project program, and I have
the code created within MS Project that I would like to execute, but I'm
having trouble linking the two (i.e. getting the code w/in Access to open
Project, execute the code, and then close Project).  Can anyone provide some
help?

P.S. If anyone is interested in why I'm doing this I'm importing the MS
Project date into Access for the purpose of running reports, queries, etc.
which Project doesn't do very well.

--
Derek C. Astle



Sat, 05 Jul 2003 08:45:19 GMT  
 Help - Module Execution in another program
Derek

Since you already succeeded in opening MS Project through MS Access code
(automation with MS Project as Automation Server & Access as Automation
Client, I supposed), post your code including your attempts.

Also, describe how you run the MS Project code in MS Project, e.g. open a
particular file then do this, then do that in MS Project.

You will find that it is more to do with MS Project code rather than Access
code.
For example, if you have created objMSProjectApp from Access, you may find
that if you open "MyProject" thru: MS Project code by

Open "C:\...\MyProject..."     then in Access VBA, you use:

objMSProjectApp.Open "C:\...\MyProject..."     will open "MyProject..."
...
(example only.  I don't know MS Project VBA)

HTH
Van T. Dinh


Quote:
> I'm not sure if anyone can help, but I would like to create a module
within
> MS Access 2000 that will execute some code within MS Project 2000.  I have
> already created the code that will open the MS Project program, and I have
> the code created within MS Project that I would like to execute, but I'm
> having trouble linking the two (i.e. getting the code w/in Access to open
> Project, execute the code, and then close Project).  Can anyone provide
some
> help?

> P.S. If anyone is interested in why I'm doing this I'm importing the MS
> Project date into Access for the purpose of running reports, queries, etc.
> which Project doesn't do very well.

> --
> Derek C. Astle




Sat, 05 Jul 2003 21:41:08 GMT  
 Help - Module Execution in another program
Here is the code from MS Access executing the MS Project program:

Private Sub Step2__Import_Data_from_MS_Project_Click()
On Error GoTo Err_Step2__Import_Data_from_MS_Project_Click

    Dim stAppName As String

    stAppName = "C:\Program Files\Microsoft Office\Office\WINPROJ.EXE"
    Call Shell(stAppName, 1)

Exit_Step2__Import_Data_from_MS_Project_:
    Exit Sub

Err_Step2__Import_Data_from_MS_Project_Click:
    MsgBox Err.Description
    Resume Exit_Step2__Import_Data_from_MS_Project_

End Sub

Here is the code in MS Project that I would like to execute as part of this
procedure:

Sub TT_Indicator_Generation()
' This macro will open the TT_Master.mpp file, export the data to the
TT_Master.mdb database, and close the TT_Master.mpp file.
' Opens the TT_Master.mpp file
    FileOpen Name:="V:\DT\TT\Schedule\TT_Master.mpp", ReadOnly:=False,
FormatID:="MSProject.MPP"
' Exports All Task Data to TT_Master.mdb & creates the TT_Master (All Task)
table
    SendKeys "%a" & "{Enter}"
    FileSaveAs Name:="<V:\DT\TT\Indicators\TT_Master.mdb>",
FormatID:="MSProject.MDB8", map:="TT_Master (All Task Information)"
' Exports Overdue Task Data to TT_Master.mdb & creates the TT_Master
(Overdue Task) table
    SendKeys "%a" & "{Enter}"
    FileSaveAs Name:="<V:\DT\TT\Indicators\TT_Master.mdb>",
FormatID:="MSProject.MDB8", map:="TT_Master (Overdue Tasks)"
' Exports Two Week Outlook Task Data to TT_Master.mdb & creates the
TT_Master (Two Week Outlook) table
    SendKeys "%a" & "{Enter}"
    FileSaveAs Name:="<V:\DT\TT\Indicators\TT_Master.mdb>",
FormatID:="MSProject.MDB8", map:="TT_Master (Two Week Outlook)"
' Closes & Saves the TT_Master.mpp file
    SendKeys "%y" & "%n"
    FileClose pjPromptSave
' Displays a message indicating Macro completion
    MsgBox "TT_Master.mdb Tables Successfully Updated", vbInformation
End Sub

The end goal would be to execute the code in MS Project from within MS
Access.  Currently I am only able to open MS Project and then manually
execute the code in MS Project using a custom mapped button.  I would like
to automate the process from MS Access to open MS Project, execute the code
shown here, and then close MS Project.  Any help would be appreciated.

--
Derek C. Astle



Quote:
> Derek

> Since you already succeeded in opening MS Project through MS Access code
> (automation with MS Project as Automation Server & Access as Automation
> Client, I supposed), post your code including your attempts.

> Also, describe how you run the MS Project code in MS Project, e.g. open a
> particular file then do this, then do that in MS Project.

> You will find that it is more to do with MS Project code rather than
Access
> code.
> For example, if you have created objMSProjectApp from Access, you may find
> that if you open "MyProject" thru: MS Project code by

> Open "C:\...\MyProject..."     then in Access VBA, you use:

> objMSProjectApp.Open "C:\...\MyProject..."     will open "MyProject..."
> ...
> (example only.  I don't know MS Project VBA)

> HTH
> Van T. Dinh



> > I'm not sure if anyone can help, but I would like to create a module
> within
> > MS Access 2000 that will execute some code within MS Project 2000.  I
have
> > already created the code that will open the MS Project program, and I
have
> > the code created within MS Project that I would like to execute, but I'm
> > having trouble linking the two (i.e. getting the code w/in Access to
open
> > Project, execute the code, and then close Project).  Can anyone provide
> some
> > help?

> > P.S. If anyone is interested in why I'm doing this I'm importing the MS
> > Project date into Access for the purpose of running reports, queries,
etc.
> > which Project doesn't do very well.

> > --
> > Derek C. Astle




Sat, 05 Jul 2003 23:15:02 GMT  
 Help - Module Execution in another program
Derek

I mainly use Automation rather than Shell to do this sort of interaction.
Another problem is that I don't have MS Project on my PC at present to try
in out.  However, if you look into Access Help on "Startup command-line
options",  you will find a "/x macro" option which you can use in Shell to
open Access and run a (more or less "autoexec") macro.  There may be a
similar option in the command-line options for MS Project that you can
include in Shell command to run your Sub on MS Project's opening.

Alternatively, you may want to use Automation by creating a MS Project
Application object from inside Access and control MS Project from Access.  I
do this all the times with Word Appln object and Excel Appln as object but
never with Project Appln object. However, I think they are very similar in
Automation.

I tend to use Automation as I can do a lot more in controlling the
Automation Server from the Automation Client than Shell.

Check Access Help on the follwing topics:
* Understand Automation
* Understand Automation (Microsoft Access)

HTH
Van T. Dinh


Quote:
> Here is the code from MS Access executing the MS Project program:

> Private Sub Step2__Import_Data_from_MS_Project_Click()
> On Error GoTo Err_Step2__Import_Data_from_MS_Project_Click

>     Dim stAppName As String

>     stAppName = "C:\Program Files\Microsoft Office\Office\WINPROJ.EXE"
>     Call Shell(stAppName, 1)

> Exit_Step2__Import_Data_from_MS_Project_:
>     Exit Sub

> Err_Step2__Import_Data_from_MS_Project_Click:
>     MsgBox Err.Description
>     Resume Exit_Step2__Import_Data_from_MS_Project_

> End Sub

> Here is the code in MS Project that I would like to execute as part of
this
> procedure:

> Sub TT_Indicator_Generation()
> ' This macro will open the TT_Master.mpp file, export the data to the
> TT_Master.mdb database, and close the TT_Master.mpp file.
> ' Opens the TT_Master.mpp file
>     FileOpen Name:="V:\DT\TT\Schedule\TT_Master.mpp", ReadOnly:=False,
> FormatID:="MSProject.MPP"
> ' Exports All Task Data to TT_Master.mdb & creates the TT_Master (All
Task)
> table
>     SendKeys "%a" & "{Enter}"
>     FileSaveAs Name:="<V:\DT\TT\Indicators\TT_Master.mdb>",
> FormatID:="MSProject.MDB8", map:="TT_Master (All Task Information)"
> ' Exports Overdue Task Data to TT_Master.mdb & creates the TT_Master
> (Overdue Task) table
>     SendKeys "%a" & "{Enter}"
>     FileSaveAs Name:="<V:\DT\TT\Indicators\TT_Master.mdb>",
> FormatID:="MSProject.MDB8", map:="TT_Master (Overdue Tasks)"
> ' Exports Two Week Outlook Task Data to TT_Master.mdb & creates the
> TT_Master (Two Week Outlook) table
>     SendKeys "%a" & "{Enter}"
>     FileSaveAs Name:="<V:\DT\TT\Indicators\TT_Master.mdb>",
> FormatID:="MSProject.MDB8", map:="TT_Master (Two Week Outlook)"
> ' Closes & Saves the TT_Master.mpp file
>     SendKeys "%y" & "%n"
>     FileClose pjPromptSave
> ' Displays a message indicating Macro completion
>     MsgBox "TT_Master.mdb Tables Successfully Updated", vbInformation
> End Sub

> The end goal would be to execute the code in MS Project from within MS
> Access.  Currently I am only able to open MS Project and then manually
> execute the code in MS Project using a custom mapped button.  I would like
> to automate the process from MS Access to open MS Project, execute the
code
> shown here, and then close MS Project.  Any help would be appreciated.

> --
> Derek C. Astle



> > Derek

> > Since you already succeeded in opening MS Project through MS Access code
> > (automation with MS Project as Automation Server & Access as Automation
> > Client, I supposed), post your code including your attempts.

> > Also, describe how you run the MS Project code in MS Project, e.g. open
a
> > particular file then do this, then do that in MS Project.

> > You will find that it is more to do with MS Project code rather than
> Access
> > code.
> > For example, if you have created objMSProjectApp from Access, you may
find
> > that if you open "MyProject" thru: MS Project code by

> > Open "C:\...\MyProject..."     then in Access VBA, you use:

> > objMSProjectApp.Open "C:\...\MyProject..."     will open "MyProject..."
> > ...
> > (example only.  I don't know MS Project VBA)

> > HTH
> > Van T. Dinh



> > > I'm not sure if anyone can help, but I would like to create a module
> > within
> > > MS Access 2000 that will execute some code within MS Project 2000.  I
> have
> > > already created the code that will open the MS Project program, and I
> have
> > > the code created within MS Project that I would like to execute, but
I'm
> > > having trouble linking the two (i.e. getting the code w/in Access to
> open
> > > Project, execute the code, and then close Project).  Can anyone
provide
> > some
> > > help?

> > > P.S. If anyone is interested in why I'm doing this I'm importing the
MS
> > > Project date into Access for the purpose of running reports, queries,
> etc.
> > > which Project doesn't do very well.

> > > --
> > > Derek C. Astle




Sun, 06 Jul 2003 06:24:10 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Interrupting Module Program Execution

2. HELP / Sound & simple program execution

3. WE NEED HELP URGENTLY /unloading a lib after program execution

4. ***Getting Access 2.0 to pause in the execution of a module

5. Pausing program execution

6. Displaying Cursor during program execution

7. CA-Realizer program execution speed problem !!!

8. Count Program Executions

9. Remote execution of programs

10. Question on Program Execution.

11. Ending program execution

12. clicking on menus stops program execution.??

 

 
Powered by phpBB® Forum Software