+ Reply to Thread
Results 1 to 4 of 4

Runtime Error 1004 - File Format Invalid

  1. #1
    Registered User
    Join Date
    04-15-2017
    Location
    USA
    MS-Off Ver
    2013
    Posts
    2

    Runtime Error 1004 - File Format Invalid

    Good Day,

    I am trying to open up a word file via Excel VBA and am encountering a problem I've not before. Looking for some assistance.

    Here is my code:

    Please Login or Register  to view this content.
    It seems to be a pretty simple code and I currently use the same code in other Macros to open other Excel files, however, this is my first for trying to open a word document.

    The error I am receiving is "Run-time error '1004': Test.docx: file format is not valid."

    This is a brand new file I've created just for testing purposes.

    Thoughts?

  2. #2
    Forum Expert
    Join Date
    02-14-2009
    Location
    .
    MS-Off Ver
    ................
    Posts
    2,840

    Re: Runtime Error 1004 - File Format Invalid

    use the same code in other Macros to open other Excel files
    Perhaps, but this isn't an Excel file and Excel knows nothing about the format of Word files...

    Maybe if you explained what you are trying to do?

  3. #3
    Registered User
    Join Date
    04-15-2017
    Location
    USA
    MS-Off Ver
    2013
    Posts
    2

    Re: Runtime Error 1004 - File Format Invalid

    Hi cytop,

    Thanks for the reply.

    What I am trying to do is open a Word document using VBA within an Excel document. That's it.

    In the overall scheme of things, I am wanting to populate columns within the word document using information from the Excel document.

    But, this is the first part. Once I get this down, I can focus on the other parts. This is my first foray into Word manipulation using Excel.

    Thank you

  4. #4
    Forum Expert
    Join Date
    02-14-2009
    Location
    .
    MS-Off Ver
    ................
    Posts
    2,840

    Re: Runtime Error 1004 - File Format Invalid

    You need to create an instance of Word. THen the code can manipulate that instance using 'standard' Word VBA commands...
    Please Login or Register  to view this content.
    I'm not going into the ins and outs of Early or Late binding. For info, that uses late binding so you will not get intellisense. If you want sample code for an operation then use the macro recorder in Word.
    Last edited by cytop; 04-15-2017 at 02:35 PM.

+ 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] Runtime Error 1004 cant find the file, but it knows it's name
    By PJC2013 in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 01-25-2016, 06:43 AM
  2. Runtime error 1004 when trying to save file via VBA
    By avh in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-09-2015, 03:20 AM
  3. Replies: 0
    Last Post: 11-22-2013, 07:28 AM
  4. [SOLVED] Receiving Runtime Error 1004 -Cannot Access file
    By Dean Staples in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-30-2013, 09:27 PM
  5. Runtime Error 1004 : file could not be accessed
    By deepyogi in forum Excel General
    Replies: 1
    Last Post: 07-24-2009, 11:54 AM
  6. File Name Causes Runtime Error 1004
    By Robert in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-10-2005, 10:55 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