ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Open a ms project file from excel using vba? (https://www.excelbanter.com/excel-programming/370195-open-ms-project-file-excel-using-vba.html)

Moto34

Open a ms project file from excel using vba?
 
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.

Jim Cone

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.


All times are GMT +1. The time now is 09:44 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com