Excel and Project seize

arShort

New Member
Joined
Jul 23, 2013
Messages
11
I am trying to get excel to open a MS Project file and then run a project macro on it.

What is happen is that when I run my code it works, and then excels VBA window freezes up and the run arrow goes away, and if I try to open project I just get a chiming noise and it won't open.

For now I have to select the MS Project file from a directory, but in the future I would like it to go through the folder and open all of the file in the folder

EXCEL CODE
Sub ImportMSProject()
Dim FileToOpen
Dim mpApp As MSProject.Application
Dim prjmacro As Object
'Identify the File to Open - START
FileToOpen = Application.GetOpenFilename("Microsoft Project Files (*.mpp), *.mpp")
If FileToOpen = False Then
Exit Sub
End If
'Identify the File to Open - END


'Open the MSProject file - START
Set mpApp = New MSProject.Application
mpApp.Visible = True
AppActivate "Microsoft Project"
mpApp.FileOpen FileToOpen
'Open the MSProject file - END


mpApp.Macro "saveasxlsmac"


mpApp.FileClose pjDoNotSave
mpApp.Quit
Set mpApp = Nothing
AppActivate "Microsoft Excel"


End Sub

PROJECT CODE

Sub saveasxlsmac()
' Macro saveasxlsmac
' Macro Recorded Wed 6/12/13
flnm = ActiveProject
FileSaveAs Name:="C:\Users\Adam\Documents\Grant Engineering\Projects\Landing Pad\Excel Raw\" & flnm & ".xls", FormatID:="MSProject.XLS5", map:="Integration Report Draft 5"


FileExit False


End Sub
 
Last edited:

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
What's prjApp? I strongly recommend that you put Option Explicit at the top of your module. That will force you to declare all variables.
 
Upvote 0
Sorry that should say mpApp, I copied the wrong code. I edited my original post to reflect the correct code
 
Upvote 0
Why can't you put your save as code in your Excel procedure, suitably qualifying any properties/methods of course.
 
Upvote 0
Because all of the settings for how it maps to excel from project are in project and I don't believe can be used outside of project
 
Upvote 0
Sorry, I don't understand. You are automating MS Project so I don't see how settings aren't available. I must say that I don't actually use MS project.
 
Upvote 0
What I am doing is exporting the Project file to Excel, which allows you to map it (basically use a template). My mapping setting is map:="Integration Report Draft 5"
 
Upvote 0

Forum statistics

Threads
1,223,236
Messages
6,170,915
Members
452,366
Latest member
TePunaBloke

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top