I'm trying to open a folder of mpp files in sequence, copy some data, paste it in an Excel sheet and fully automate the whole procedure. Here it is so far.
Then the excel sheet opens and the auto_open calls this macro. (The 3 macros in the midst are just formatting and populating some fields, nothing major)VB Code:
Dim temp As Object Dim path As String Dim currfile As String Dim Path1 As String Dim xl3 As Object Dim Temp1 As String Dim appXL As Object currfile = Dir("\\filesvr\department\pe\sch_control\IMSApr\*.mpp") path = "\\filesvr\department\pe\sch_control\IMSApr\" Path1 = "\\filesvr4\department\pe\sch_control\downloads\beth\Update_Template.xls" Do While currfile <> "" Set temp = GetObject(path & currfile) WindowNewWindow Projects:=currfile, ShowDialog:=False '*********************** chDir ("\\P989-filesvr4\department\pe\sch_control\IMSApr\") Temp1 = ActiveWindow Parent.WindowActivate (Temp1) OutlineShowAllTasks ViewApply Name:=".SLRS Export for Update Sheet" SelectTaskColumn Column:="ID", Additional:=19, Extend:=True EditCopy Set xl3 = GetObject(Path1)
That part works fine and saves it correctly. This is the ending of the macro code in ProjectVB Code:
Dim mon As String mon = Format(Now, "mmmm_yy") Dim tempxl As String Dim path As String Application.ScreenUpdating = False path = "\\filesvr\department\pe\sch_control\Downloads\Beth\Originals\" Range("A17").Select ActiveSheet.Paste If Range("E18").Text <> "" Then Columns("A:A").Select Selection.Delete Shift:=xlToLeft Macro2 Macro3 Macro6 tempxl = Range("E18").Text Range("A11").Select ActiveWorkbook.SaveAs path & tempxl & "_" & mon & "_Update_", _ FileFormat:=xlNormal End If
It finishes the last portion and closes the open Project file without saving but will not loop, it just ends. I'm pretty sure it has to do with the possiblity that the macro running in Excel takes longer to complete and is running at the same time as the macro in Project. It's hard to control one office application from another. Is it possible to make this loop work or am I trying in vain? Any help offered would be appreciated.VB Code:
xl3.Parent.Windows(1).Close FileClose pjDoNotSave '************************ currfile = Dir Loop MsgBox "Status Sheets completed." End Sub![]()
~QueenB


Reply With Quote