+ Reply to Thread
Results 1 to 6 of 6

Very simple code not working

  1. #1
    Registered User
    Join Date
    11-10-2010
    Location
    Canada
    MS-Off Ver
    Excel 2003
    Posts
    7

    Very simple code not working

    Hello,
    I have a very simple code that is not working and I don't understand why because the exact same code is working for an excel document. (I guess it might be a problem with the References set up).
    Here is the code:
    Please Login or Register  to view this content.
    I get error '1004' file format invalid...

    Here is my the references I have set up:
    Visual basic for applications
    Microsoft Excel 12.0 Object Library
    Microsoft Word 12.0 Object Library
    OLE Automation

    Thank you very much for any help !
    Last edited by Leith Ross; 12-03-2010 at 03:28 PM. Reason: Added Code Tags

  2. #2
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Re: Very simple code not working

    You appear to be trying to open a Word Template as an Excel document, Is this what you actually wanted to do?
    Martin

  3. #3
    Registered User
    Join Date
    11-10-2010
    Location
    Canada
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: Very simple code not working

    No, I am trying to open a Word template when writing code in excel..
    maybe activeworkbook is not appropriate... how can I change my code to make it work?
    Thank you

  4. #4
    Registered User
    Join Date
    11-10-2010
    Location
    Canada
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: Very simple code not working

    or workbook.add I mean..

  5. #5
    Registered User
    Join Date
    11-10-2010
    Location
    Canada
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: Very simple code not working

    ok I got it... by the way where can we signal that the post has been resolved?

  6. #6
    Valued Forum Contributor ron2k_1's Avatar
    Join Date
    09-30-2009
    Location
    Not the USA
    MS-Off Ver
    Excel 2003, 2007
    Posts
    606

    Re: Very simple code not working

    Quote Originally Posted by hockey123 View Post
    ok I got it... by the way where can we signal that the post has been resolved?
    EDIT your original post, go to ADVANCED, and then on the prefix slot, select SOLVED
    Ron
    Knowledge is knowing that a tomato and pepper are fruits. Wisdom is knowing whether to put these in a fruit salad

    Kindly

    [1] Use code tags. Place "[code]" before the first line of code and "[/code"]" after the last line of code. Exclude quotation marks
    [2] Mark your post [SOLVED] if it has been answered satisfactorily by editing your original post in advanced mode.
    [3] Thank (using the little scale) those that provided useful help; its nice and its very well appreciated

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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