Excel to run in MS Project and Back

paspuggie48

New Member
Joined
Jun 21, 2011
Messages
35
Hi All....

I'm still new to all this but fascinated by it all...great forum :)

I was going to ask a question but by the time I wrote it all out I found the answer. Anyway, FYI (if anyone would like to know this) I have pasted it for you to read......
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

I have an Excel document that I have to populate with information from MS Project. Having looked around I've managed to create the following basic code as: -

Sub openProject()
Dim appProj As MSProject.Application
Dim aProg As MSProject.Project

Set appProj = CreateObject("Msproject.Application")
appProj.FileOpen "C:\Work\Monlevade\AMM BFB - TIME SCHEDULE\2011\MASTER\PWLU-5018535-0000223.mpp"
Set aProg = appProj.ActiveProject
appProj.Visible = True

OutlineShowTasks OutlineNumber:=pjTaskOutlineShowLevel2
SelectTaskField Row:=1, Column:="Name"
OutlineHideSubTasks
SelectTaskField Row:=1, Column:="Name"
OutlineHideSubTasks
SelectTaskField Row:=1, Column:="Name"
OutlineHideSubTasks
SelectTaskField Row:=-3, Column:="Name"
SelectTaskField Row:=0, Column:="Name", Width:=1, Height:=42, Extend:=True
EditCopy

ActiveSheet.Paste
Range("A1").Select

End Sub

In essence, the above shows MS project is started and the specific file is opened.
It then performs the functions in MS Project and pastes the information back into my Excel document.
The only snag I have is that the screen stays on viewing MS Project and not the original Excel document I started from.
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

My question was how to get the macro to view Excel again...it was simple in the end (as long as it keeps on working) and that was to delete the line
appProj.Visible = True

Regards
Paul
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney

Forum statistics

Threads
1,224,613
Messages
6,179,903
Members
452,948
Latest member
Dupuhini

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