+ Reply to Thread
Results 1 to 4 of 4

Run-time error '1004' when trying to export data from Word to Excel.

  1. #1
    Registered User
    Join Date
    10-30-2013
    Location
    Leicestershire
    MS-Off Ver
    Excel 2003
    Posts
    16

    Run-time error '1004' when trying to export data from Word to Excel.

    Hi Everyone,

    I have set up a word template that when an update button is pressed draws information from an Excel worksheet to place holders in the word document. However each time I run the code I get an error "run-time error '100', which then asks me to check the document's path and/or delet the Excel sheet from my recent documents.

    I have checked the path and deleted all recent documents but this error still occurs. Could this error be from running an Excel document that is macro enabled? If so could anyone prvide code to over come this problem.

    My current code is below:

    Please Login or Register  to view this content.

  2. #2
    Forum Guru macropod's Avatar
    Join Date
    12-22-2011
    Location
    Canberra, Australia
    MS-Off Ver
    Word, Excel & Powerpoint 2003 & 2010
    Posts
    3,726

    Re: Run-time error '1004' when trying to export data from Word to Excel.

    If the data always come from the same Excel cell, simply copy the Excel range, then paste it into your template using Paste Special with the 'paste link' option and the data format you require. Then, whenever you create a new document from the template, simply update the links, using .Fields.Update. You can then unlink the data using .Fields.Unlink. That way, there's no need to automate Excel or open the workbook.
    Cheers,
    Paul Edstein
    [Fmr MS MVP - Word]

  3. #3
    Registered User
    Join Date
    10-30-2013
    Location
    Leicestershire
    MS-Off Ver
    Excel 2003
    Posts
    16

    Re: Run-time error '1004' when trying to export data from Word to Excel.

    so my code would look like this?

    Please Login or Register  to view this content.
    Or do I need to take out the path of my document?

  4. #4
    Forum Guru macropod's Avatar
    Join Date
    12-22-2011
    Location
    Canberra, Australia
    MS-Off Ver
    Word, Excel & Powerpoint 2003 & 2010
    Posts
    3,726

    Re: Run-time error '1004' when trying to export data from Word to Excel.

    No, you field could be no more than:
    Please Login or Register  to view this content.
    If, however, there was a possibility that you'd want to refer to a different range, a different worksheet, or a different workbook, you would need to modify the field code first. That, too, is quite easy to do in vba without ever automating Excel.

+ 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. [SOLVED] Chart.Export error '1004' after upgrade to Excel 2003
    By Marsel in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-17-2005, 08:25 AM
  2. [SOLVED] Run-time error '1004'; Method 'Export' of object'_Chart' failed
    By Father Guido in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-25-2005, 10:35 AM
  3. ASP & EXCEL2003 - RUN-TIME ERROR 1004 in Export method
    By Mau in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-12-2005, 04:23 AM
  4. [SOLVED] excel chart export error runtime 1004
    By Mau in forum Excel Charting & Pivots
    Replies: 3
    Last Post: 08-17-2005, 07:05 AM
  5. [SOLVED] excel chart export error runtime 1004
    By Mau in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-04-2005, 05:05 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