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