Consulting

Results 1 to 2 of 2

Thread: file save macro

  1. #1
    VBAX Tutor
    Joined
    Aug 2007
    Posts
    294
    Location

    file save macro

    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


    [VBA]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[/VBA]

  2. #2
    VBAX Tutor
    Joined
    Aug 2007
    Posts
    294
    Location
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •