+ Reply to Thread
Results 1 to 9 of 9

VBA for saving excel worksheet into .pdf document

Hybrid View

  1. #1
    Registered User
    Join Date
    11-24-2012
    Location
    UAE
    MS-Off Ver
    Excel 2010
    Posts
    11

    VBA for saving excel worksheet into .pdf document

    Hi,

    I was using the VBA

    Sub Savepdf()
    
    Application.ScreenUpdating = False
    Dim fName As String
    With ActiveSheet
        fName = .Range("E4").Value
        .ExportAsFixedFormat Type:=xlTypePDF, FileName:= _
                fName & ".pdf", Quality:=xlQualityStandard, _
                IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False
    End With
    Application.ScreenUpdating = True
    End Sub
    but now it seems it is not responding/nor giving any result. Please let me know what could be the reason.

    Regards,
    Seemanth
    Last edited by seemanthv; 03-05-2014 at 02:12 AM. Reason: Issue got resolved

  2. #2
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 365 on Win11 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: VBA for saving excel worksheet into .pdf document

    Hi, seemanthv,

    welcome to ExcelForun. Please have a look at our Forum Rules, especially Rule #3 and wrap your procedure with code-tags.

    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  3. #3
    Registered User
    Join Date
    11-24-2012
    Location
    UAE
    MS-Off Ver
    Excel 2010
    Posts
    11

    Re: VBA for saving excel worksheet into .pdf document

    Hi Holger,

    Required amendment has been made.

    Regards,
    Seemanth

  4. #4
    Registered User
    Join Date
    02-27-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    77

    Re: VBA for saving excel worksheet into .pdf document

    Quote Originally Posted by seemanthv View Post
    Hi,

    I was using the VBA
    Please change the code from OpenAfterPublish:=False to OpenAfterPublish:=True

  5. #5
    Registered User
    Join Date
    11-24-2012
    Location
    UAE
    MS-Off Ver
    Excel 2010
    Posts
    11

    Re: VBA for saving excel worksheet into .pdf document

    Hi chinraj,

    Thanks for your comment.

    Regards,
    Seemanth

  6. #6
    Registered User
    Join Date
    08-06-2013
    Location
    Quebec
    MS-Off Ver
    Excel 2013
    Posts
    31

    Re: VBA for saving excel worksheet into .pdf document

    I've tried your code and it's fine. The only thing I've added is a path.

    Sub Savepdf()
    
    Application.ScreenUpdating = False
    Dim fName As String
    With ActiveSheet
    fName = .Range("E4").Value
    .ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
    "C:\Users\Allen\" & fName & ".pdf", Quality:=xlQualityStandard, _
    IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False
    End With
    Application.ScreenUpdating = True
    End Sub

  7. #7
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 365 on Win11 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: VBA for saving excel worksheet into .pdf document

    Hi, seemanthv,

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE] [/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here



    (This thread should receive no further responses until this moderation request is fulfilled, as per Forum Rule 7)

    Ciao,
    Holger

  8. #8
    Registered User
    Join Date
    08-06-2013
    Location
    Quebec
    MS-Off Ver
    Excel 2013
    Posts
    31

    Re: VBA for saving excel worksheet into .pdf document

    Has your problem been solved?

  9. #9
    Registered User
    Join Date
    11-24-2012
    Location
    UAE
    MS-Off Ver
    Excel 2010
    Posts
    11

    Re: VBA for saving excel worksheet into .pdf document

    Hi allenz0rz,

    Thanks a lot, it got solved. Actually putting the location was fine, because previously it was getting saved in My Documents and I was looking for pdfs in the same folder of the workbook

    Regards,
    Seemanth

+ 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. Saving excel as word document
    By excel_help12 in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 05-25-2012, 02:55 AM
  2. [SOLVED] Saving Document in Excel
    By Sam in forum Excel General
    Replies: 6
    Last Post: 07-11-2006, 01:35 PM
  3. [SOLVED] Saving excel document as a .csv and not lose formats?
    By karenv in forum Excel General
    Replies: 1
    Last Post: 10-26-2005, 02:05 PM
  4. [SOLVED] Automatically Saving an Excel Document as a Web Page
    By Danimagus in forum Excel General
    Replies: 0
    Last Post: 06-01-2005, 06:05 PM
  5. [SOLVED] When saving a worksheet in excel message "document not saved"
    By Bailey in forum Excel General
    Replies: 1
    Last Post: 01-24-2005, 08:06 PM

Tags for this Thread

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