PDA

View Full Version : [SLEEPER:] file save macro



Pete
10-16-2008, 08:33 AM
Hi Experts

How would i amend the following VBA in MSP to add the following names to pages 1- 3

page 1 = Argentina
page 2 = Australia
page 3 = Austria

etc...

and save the file to my documents with file extension .pdf



Sub PrintToPDF()
' Macro Macro11
' Macro Recorded Thu 16/10/08 by NLKELP.
FilePrint FromPage:=1, ToPage:=1, FromDate:="01/07/08 08:00", ToDate:="31/03/12 17:00"
SelectTaskField Row:=-4, Column:="Baseline Finish"
SelectTaskField Row:=-1, Column:="Name"
FilePrint FromPage:=2, ToPage:=2, FromDate:="01/07/08 08:00", ToDate:="31/03/12 17:00"
SelectTaskField Row:=-4, Column:="Baseline Finish"
SelectTaskField Row:=-1, Column:="Name"
End Sub

Pete
10-17-2008, 12:06 AM
Second attempt......but cannot get the macro to automatically change the file name


Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Dim FilePath As String
If SaveAsUI Then
FilePath = Application.GetSaveAsFilename(ThisWorkbook.Path & "\" & ActiveSheet.Name, "Text File (*.pdf), *.pdf")
If Not FilePath = "False" Then
ThisWorkbook.SaveAs FilePath
End If
Cancel = True
End If
End Sub