+ Reply to Thread
Results 1 to 5 of 5

open and manipulate embedded word documents from excel?

  1. #1
    Registered User
    Join Date
    09-16-2009
    Location
    Minneapolis, MN
    MS-Off Ver
    Excel 2003
    Posts
    9

    open and manipulate embedded word documents from excel?

    I am trying to open several word documents embedded in excel, open them in word, and save them to a folder on the computer using excel vba. I can get the embedded document to open, but it loses control of the opened document after that and opens a new instance of word. Can anyone help on this?

  2. #2
    Registered User
    Join Date
    09-16-2009
    Location
    Minneapolis, MN
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: open and manipulate embedded word documents from excel?

    Here is the code I am using so far....


    Sub ExcelToExistingWordDoc()
    Dim MyDir As String
    Dim strPath As String
    Dim WrdApp As Word.Application
    Dim wrdDoc As Word.Document
    Dim windowCt As Integer

    MyDir = ActiveWorkbook.Path
    strPath = MyDir & "\Sample Touchpoint"
    ' Reference instance of Word
    On Error Resume Next
    ' Check whether Word is running
    ActiveSheet.Shapes("Object 46").Select

    Selection.Verb Verb:=xlOpen
    Set wrdDoc = WrdApp.ActiveDocument
    GoTo Line29:



    Line29:
    With wrdDoc

    ''---------------------
    '' Do Some Stuff Here
    ''---------------------


    .SaveAs (strPath & "\TESTPRES.doc")
    .Close
    End With
    WrdApp.Quit

    Set wrdDoc = Nothing
    Set WrdApp = Nothing

    End Sub
    for some reason, right after the Selection.Verb Verb =xlOpen command, the macro completely halts, and I'm left sitting in word with the open document. Any ideas of where I may be missing something?
    Last edited by mcledavid; 09-18-2009 at 03:20 PM.

  3. #3
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: open and manipulate embedded word documents from excel?

    Please take a few minutes to read the forum rules, and then edit your post to add code tags.

    Thanks.
    Entia non sunt multiplicanda sine necessitate

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: open and manipulate embedded word documents from excel?

    Also read the forum rules about cross-posting.

  5. #5
    Registered User
    Join Date
    09-16-2009
    Location
    Minneapolis, MN
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: open and manipulate embedded word documents from excel?

    Sorry, shg. Is there anyone who has any suggestions based on the aforementioned problem?

    I've been doing some reading and I think I may have to create a new class variable to monitor the actions taking place in MS Word after I open the embedded word document. Not sure I quite understand this. can anyone help? Thanks

+ 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