+ Reply to Thread
Results 1 to 4 of 4

trying to export a word document created using excel spreadsheet data to pdf

  1. #1
    Registered User
    Join Date
    03-03-2014
    Location
    Albany, NY
    MS-Off Ver
    Excel 2010
    Posts
    10

    trying to export a word document created using excel spreadsheet data to pdf

    I created a word document report from spreadsheet data. I am able to save the word document, but am unable to figure out how to export the word document to a pdf document. Below is my code creating and saving the word document and my attempt to export it to pdf. Receive the message Object variable or with block variable not set.

    Please Login or Register  to view this content.

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: trying to export a word document created using excel spreadsheet data to pdf

    Hello twyblue,

    Welcome to the Forum!

    You have created the Word document from inside Excel at run time. A method known as "late binding". One drawback to this method is named constants, like wdExportFormatPDF, are not available at run time. You must either define this constant in your code or use its numeric value. In the code below, I defined the constant. For me, it maintains consistency with the object model and is more easily understood.

    Simply put, Binding is the act of associating objects with their defined names in memory during compile time. With early binding, the compiler can tell the CPU to jump directly to the object’s address. With late binding, the program has to read the address held in the object's pointer and then jump to that address. This involves one extra step, making it slightly slower. However, the advantage of late binding is that it is more flexible than early binding. Because decisions about which functions to call, like which version to use, do not need to be made until run time.

    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Registered User
    Join Date
    03-03-2014
    Location
    Albany, NY
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: trying to export a word document created using excel spreadsheet data to pdf

    Thanks for the explanation and the solution. It was extremely helpful!

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: trying to export a word document created using excel spreadsheet data to pdf

    Hello twyblue,

    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. Replies: 0
    Last Post: 02-20-2013, 09:57 AM
  2. Replies: 1
    Last Post: 06-10-2010, 02:15 PM
  3. Export spreadsheet data to PDF or Word document
    By Kim Jespersen in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-06-2006, 05:16 AM
  4. moving data from excel spreadsheet to word document
    By HeatherO in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-19-2005, 10:06 PM
  5. [SOLVED] How to: export data from a spreadsheet to a word document
    By Maddoktor in forum Excel General
    Replies: 0
    Last Post: 02-10-2005, 02:06 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