Open a ms project file from excel using vba?

G

Guest

Does anyone know what syntax to use to open an existing Microsoft Project
file from within Excel? I am wanting to have the user be entering data into
Excel and then have VBA run to open a MS Project file which will then get the
data from excel and manipulate it from there. Everything works except for
having VBA in excel open a specific ms project file at a specific location.
Please help.
 
J

Jim Cone

'Most of this from a post by Rob Bruce - public.excel.programming - 05/26/2005...

'If you use the shellexecute API you don't need to know anything about the app.
'(just the file path and file, as the API determines the program to use - JBC)
'-------------------------
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _
(ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, _
ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long

'Calls the other sub
Sub OpenMyFile()
OpenFileInDefaultApp "C:\Program Files\Microsoft Office\Office\Library\MyFile.prj"
End Sub


Sub OpenFileInDefaultApp(FullName As String)
ShellExecute 0, vbNullString, FullName, 0&, 0&, 1
End Sub
--------------
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware



"Moto34"
<[email protected]>
wrote in message
Does anyone know what syntax to use to open an existing Microsoft Project
file from within Excel? I am wanting to have the user be entering data into
Excel and then have VBA run to open a MS Project file which will then get the
data from excel and manipulate it from there. Everything works except for
having VBA in excel open a specific ms project file at a specific location.
Please help.
 

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