Results 1 to 2 of 2
  1. #1
    Star Lounger
    Join Date
    Feb 2002
    Location
    Fort Collins, Colorado, USA
    Posts
    61
    Thanks
    0
    Thanked 0 Times in 0 Posts

    VBA excel - word (2003)

    I know that you guys often provide a VBA solution so I hope you can help me. I need to do this repeatedly:

    1. Working in excel say ExcelDoc.xls, which has a block of cells on each tab, consisting of text in cells and perhaps a picture as well
    2. Create and open a Word file, WordDoc.doc
    3. In ExcelDoc.xls, select the block and copy to clipboard (ctrl-A on each tab will do it; the range could also be named but I don't think that is necessary)
    4. Jump to Worddoc.doc and paste special as enhanced metafile
    5. Repeat 3 and 4 until done.

    I can do this manually just fine, but I need to automate it. The macro recorder won't do it. I'm hoping someone out there can give me a VBA routine that can. The routine would preferably reside in ExcelDoc.xls and run from there.

    Bonus:
    It would be really good if I had a way to save each pasted "image" as a stand-alone file, blockN.emf. I presently do this by pasting the block into Visio and then SaveAs EMF file in Visio. That also works great but I need to do it without Visio.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 18 Times in 18 Posts

    Re: VBA excel - word (2003)

    Try the code in the attached text file. It uses late binding, so you don't have to set a reference to the Microsoft Word 11.0 Object Library.
    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •