+ Reply to Thread
Results 1 to 8 of 8

VBA for Insert Object >>Create from File>>Choose File. In Word Document

  1. #1
    Registered User
    Join Date
    06-04-2015
    Location
    Minneapolis, Minnesota
    MS-Off Ver
    2013
    Posts
    5

    VBA for Insert Object >>Create from File>>Choose File. In Word Document

    Hello,

    I am attempting to create a VBA to simply Insert an Excel worksheet into a word document. I use the insert Object>>Create from File>>Choose File. I use this method because it provides a much clearer picture in the word document. I know how to write a VBA to simply copy and paste the Excel Data in to a Word document, so please don't suggest that method. If anyone has an idea how to write a VBA for this application that would be great.

    F.Y.I. I am running a office 2013 system.

    Thank you.

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: VBA for Insert Object >>Create from File>>Choose File. In Word Document

    Please Login or Register  to view this content.
    Last edited by 6StringJazzer; 06-08-2015 at 09:58 AM. Reason: Commented out debug code
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Registered User
    Join Date
    06-04-2015
    Location
    Minneapolis, Minnesota
    MS-Off Ver
    2013
    Posts
    5

    Re: VBA for Insert Object >>Create from File>>Choose File. In Word Document

    Jeff,

    Thank you fro the response, when I run the Macro I get a error. Run-time error'5': Invalid procedure call or argument. When I open up the macro it highlights the openDialog.Filters.Add "Excel workbooks", " **.xlsm"
    If you have any suggestions that would be great.

    Thank you,
    KT

  4. #4
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: VBA for Insert Object >>Create from File>>Choose File. In Word Document

    If you put "**" it will cause an error. It must be one *. You can copy and paste the code exactly as I posted it.

    Also, the debug.print and Stop lines should be removed--they were for debugging purposes and I did not mean to leave them in.

  5. #5
    Registered User
    Join Date
    06-04-2015
    Location
    Minneapolis, Minnesota
    MS-Off Ver
    2013
    Posts
    5

    Re: VBA for Insert Object >>Create from File>>Choose File. In Word Document

    That works perfect, Thank you. One more quick question, If I Want to open a specific file can I just enter that file name in, instead of "*.xlsm"?

    thank you,
    KT

  6. #6
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: VBA for Insert Object >>Create from File>>Choose File. In Word Document

    No, that would be completely different. If you want to use one specific file all the time, just use that file name here. All of the other code is to set up and query the user for the file name.

    Please Login or Register  to view this content.
    ]

  7. #7
    Registered User
    Join Date
    06-04-2015
    Location
    Minneapolis, Minnesota
    MS-Off Ver
    2013
    Posts
    5

    Re: VBA for Insert Object >>Create from File>>Choose File. In Word Document

    That works out great! thank you for all your help.

  8. #8
    Registered User
    Join Date
    06-04-2015
    Location
    Minneapolis, Minnesota
    MS-Off Ver
    2013
    Posts
    5

    Re: VBA for Insert Object >>Create from File>>Choose File. In Word Document

    Jeff,
    You have been a lot of help so far in this process, I was wondering if you know the VBA code to have the inserted object fit to the word document page. If so that would be awesome.

    Thank you,
    KT

+ 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: 06-19-2014, 02:09 PM
  2. Replies: 0
    Last Post: 04-25-2013, 03:16 PM
  3. Replies: 0
    Last Post: 06-15-2011, 02:22 PM
  4. Replies: 1
    Last Post: 10-17-2005, 04:05 AM
  5. [SOLVED] Can I insert a word document into a new excel file ?
    By Robyn78 in forum Excel General
    Replies: 2
    Last Post: 08-02-2005, 04: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