Results 1 to 3 of 3
  1. #1
    MichaelC is offline Novice
    Windows XP Access 2003
    Join Date
    Jul 2010
    Posts
    5

    VBA to create Excel sheet and a copy as PDF

    Hi -


    I have an Access 2003 application that creates various reports for our company. It creates some of them in Excel and some Access reports are put into PDF using Lebans ConvertToPDF code. Right now I am creating a new set of reports that will be in Excel. I need to have these Excel sheets also create a PDF copy that will be placed in a seperate directory. I've experimented with different things but not having a lot of luck with this. It needs to be automated so I can't have the user being prompted for where to save the PDF file.

    After the VBA code has created the Excel document, but before it closes the Excel application, .PrintOut seems to be the best option (Adobe PDF print driver). But I havent been able to find a way to automatically pass the filename to the application so the Save As box is not brought up. If I use print to file I don't see any way to get a proper PDF format. Is there a way to make this work? Not sure that is matters, but I am using Adobe 9. Any help is greatly appreciated!!!

    This is what I'm trying:
    objXL.Application.Workbooks.Add
    set objActiveWkb = objXL.Application.ActiveWorkbook

    ....code to create the layout of the report

    objActiveWkb.Worksheets(intCurSheet).Printout
    objActiveWkb.Close SaveChanges:=True, Filename:=strFileName

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2007
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930

  3. #3
    MichaelC is offline Novice
    Windows XP Access 2003
    Join Date
    Jul 2010
    Posts
    5

    Problem Solved

    Thanks! The second link you gave had a solution further down on the page that worked using Distiller. Creates a log file for some reason, but I can deal with that. Appreciate the info

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 03-02-2011, 03:08 PM
  2. Replies: 4
    Last Post: 10-07-2010, 04:45 PM
  3. Import Excel sheet with query
    By tpcervelo in forum Queries
    Replies: 1
    Last Post: 08-03-2010, 07:10 PM
  4. Importing full excel sheet to access
    By karakal in forum Import/Export Data
    Replies: 0
    Last Post: 03-22-2010, 03:48 PM
  5. problem setting Excel sheet name in vba from a form
    By dataman in forum Programming
    Replies: 2
    Last Post: 04-18-2006, 07:26 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums