+ Reply to Thread
Results 1 to 2 of 2

Want macro to save as Excel file not PDF

  1. #1
    Registered User
    Join Date
    12-29-2020
    Location
    Manchester
    MS-Off Ver
    Microsoft 365 Apps for Enterprise
    Posts
    70

    Want macro to save as Excel file not PDF

    Complete noob to VBA but I am TRYING to get my head round it...I have this code and whilst it is mostly doing what I want it to do I can't stop it saving as a PDF when I need it to be an Excel workbook that it saves as. I have changed the word PDF to xlsm everywhere I can see it but it just then saves as XXXX.xslm.pdf

    Can anyone help please?

    Sub SaveAs()
    Dim SavePath As String
    Dim SaveAs As String
    Dim FileName As String
    Dim sDate As String

    '// Save it Path
    SavePath = "S:\Customer Services\E-Timesheets NEW\"

    '// File Name
    FileName = "Timesheet WE "

    '// Format the on "C3" to TEXT
    sName = Format(Sheets("Blank Timesheet").Range("C3"), "TEXT")

    '// Format the on "B4" to YYYY-MM-DD
    sDate = Format(Sheets("Blank Timesheet").Range("AP5"), "DD-MM-YYYY")

    '// Save with File Name & Date & .pdf
    SaveAs = FileName & sDate & sName & ".pdf"
    Application.DisplayAlerts = True

    '// Export Active Sheet as pdf
    ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, FileName:= _
    SavePath & SaveAs

    Application.DisplayAlerts = True
    End Sub

  2. #2
    Forum Expert
    Join Date
    10-10-2016
    Location
    Sheffield
    MS-Off Ver
    365 and rarely 2016
    Posts
    3,212

    Re: Want macro to save as Excel file not PDF

    without your sample sheet it s difficult but something like this

    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Open .csv File and Save As Macro Capable Excel File
    By ajocius in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-20-2017, 10:23 AM
  2. Macro to create and save excel file from a master excel file
    By sunny81 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-16-2017, 10:29 PM
  3. Macro to create and save excel file from a master excel file
    By sunny81 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-16-2017, 09:49 PM
  4. [SOLVED] Macro to open Excel file, run other macros save, and close file & repeat.
    By Ronnet2 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-08-2015, 09:47 AM
  5. Need macro that opens .txt file in excel, run macros and save file in batch
    By khalidness in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-11-2014, 11:00 AM
  6. Converting excel 2003 file ext macro file-save code to reflect excel 2007 exts
    By pmanoloff in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-20-2013, 12:17 PM
  7. Macro to save Excel file with date and time in the file name?
    By sonic_d_hog in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-05-2006, 02:00 PM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1