+ Reply to Thread
Results 1 to 4 of 4

Create a PDF from Excel

  1. #1
    Forum Contributor
    Join Date
    05-14-2010
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    155

    Create a PDF from Excel

    Dear Experts,
    I have a macro which create PDF from existing workbook and attaching in outlook. There are a error coming if any another excel file is open and below code gets yellow highlighted: -

    strFName = ThisWorkbook.Path & ActiveWorkbook.Name
    strFName = ActiveSheet.Range("k9").Value & ".pdf"

    ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, filename:= _
    strPath & strFName, Quality:=xlQualityStandard, _
    IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False
    Set objOutlook = CreateObject("Outlook.Application")
    Set objMail = objOutlook.CreateItem(0)

    is there any way that if i run a macro, it will find another open workbook, close them and then create pdf...?

    Please advise me with your valuable codes.

    Thanks in advance.
    Rajeev Kumar

  2. #2
    Valued Forum Contributor dotchiejack's Avatar
    Join Date
    05-21-2015
    Location
    Antwerp,Belgium
    MS-Off Ver
    2016
    Posts
    507

    Re: Create a PDF from Excel

    Hi,

    What happens when you change
    Please Login or Register  to view this content.
    in
    Please Login or Register  to view this content.
    Click the * Add Reputation below to say thanks.

  3. #3
    Forum Contributor
    Join Date
    05-14-2010
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    155

    Re: Create a PDF from Excel

    Thanks for your quick response.

  4. #4
    Valued Forum Contributor dotchiejack's Avatar
    Join Date
    05-21-2015
    Location
    Antwerp,Belgium
    MS-Off Ver
    2016
    Posts
    507

    Re: Create a PDF from Excel

    You're welcome

+ 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. Create a function to create a new excel file
    By srbelle in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 06-26-2015, 07:04 AM
  2. Replies: 7
    Last Post: 09-29-2014, 09:24 AM
  3. Replies: 4
    Last Post: 12-28-2012, 03:11 AM
  4. Replies: 3
    Last Post: 06-27-2012, 02:25 PM
  5. Replies: 3
    Last Post: 09-30-2011, 04:35 AM
  6. Replies: 1
    Last Post: 07-16-2009, 09:14 PM
  7. Replies: 2
    Last Post: 08-18-2006, 07:20 AM

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