+ Reply to Thread
Results 1 to 1 of 1

Open Word file form Excel using VBA and file path

Hybrid View

  1. #1
    Registered User
    Join Date
    06-05-2010
    Location
    Copenhagen
    MS-Off Ver
    Excel 2007
    Posts
    2

    Open Word file form Excel using VBA and file path

    Open Word file form Excel using VBA and file path

    I’m using an excel spreadsheet as an Add-in menu. Also in the same workbook is a sheet with the menu structure and paths to other excel files.

    It’s working great using this:

    Private Sub GetXLWorkbook()
        Workbooks.Open CommandBars.ActionControl.Parameter, , True
        Exit Sub
    End Sub
    Now I’m trying make it open word files as well using this:

    Sub GetWordWorkbook()
        Dim wordApp As Object
        Dim wordDoc As Object
        Set wordApp = CreateObject("Word.application")
        wordApp.visible = True
        Set wordDoc = wordApp.Documents.Open("C:\Example.doc") 
    End Sub
    Opening word files does work if I run it manually but it does not work if I write the path in my excel menu? There is a problem with this path line:

    Set wordDoc = wordApp.Documents.Open CommandBars.ActionControl.Parameter, ,
    Hope someone can help.

    KR Peter
    Last edited by psychoPETE; 06-06-2010 at 04:09 AM.

+ 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