View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Jim Cone Jim Cone is offline
external usenet poster
 
Posts: 3,290
Default Open a ms project file from excel using vba?

'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"

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.