Word addin not loaded when application is started with VBA from within Excel

Anonymous
2019-05-17T11:20:39+00:00

I have an add-in (dotm template) which is stored in Word's Startup folder. Among other things it contains a customized ribbon.

This works fine, no problems when Word is started from the menu, double clicking a document etc. The add-in is loaded and the customizations in the ribbon are visible.

However if Word is started from VBA within another application (Excel or Access) the customizations in the ribbon do not show. If I check in the Developer tab the Add-in is listed and is selected as well.

Even if I unselected it (unload) and select (load) it again from the interface, the customized ribbon does not show.

This worked fine in Office 2010 with the exact same Excel VBA code and the same add-in.

Why does it not work in Office 2016? 

Version 1904

Build 11601.20178

Microsoft 365 and Office | Word | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

42 answers

Sort by: Oldest
  1. Anonymous
    2019-05-17T12:40:43+00:00

    Hi

    Using Office 365, I am not seeing this using the following code:

    Sub wordopener()
      Dim objWord
      Dim objDoc
      Set objWord = CreateObject("Word.Application")
      Set objDoc = objWord.Documents.Add
      objWord.Visible = True
    End Sub
    

    I have 114 template Add-Ins including 5 that change the Ribbon. They all load and are active including Ribbon modifications.

    The code above is from

    https://stackoverflow.com/questions/47158574/ho...

    What code are you using to start Word?

     This forum is a user-to-user support forum. I am a fellow user.

    I hope this information helps.

    Please let me know if you have any more questions or require further help.

    You can ask for more help by replying to this post (Reply button below).

    Regards

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2019-05-17T12:50:07+00:00

    Hi Charles,

    Thanks for your reply.

    My code is sort of similar as yours.

    Sub StartWDFromXL()

    Dim oWdApp As Word.Application

    Dim oWdDoc As Word.Document

      On Error Resume Next

      Set oWdApp = GetObject(, "Word.Application")

      If Err Then

        Set oWdApp = New Word.Application

        Err.Clear

      End If

      On Error GoTo Err_Handler

      oWdApp.Visible = True

      oWdApp.Activate

      Set oWdDoc = oWdApp.Documents.Add

      oWdDoc.Range.Text = "New Doc"

      Set oWdApp = Nothing

      Set oWdDoc = Nothing

      Exit Sub

    Err_Handler:

      MsgBox Err.Number & " " & Err.Description

    End Sub

    It does not work.

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2019-05-17T12:55:43+00:00

    Hi Astrid,

    Haven't had a chance to go through this fully. This is from a first try:

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2019-05-17T13:01:12+00:00

    Reference to the Word library?

    Was this answer helpful?

    0 comments No comments
  5. Anonymous
    2019-05-17T13:02:00+00:00

    This is your code, patched:

    Sub StartWDFromXL()
    
    Dim oWdApp 'As Word.Application
    Dim oWdDoc 'As Word.Document
      On Error Resume Next
    
    Set oWdApp = GetObject(, "Word.Application")
    If Err Then
    Set oWdApp = CreateObject("Word.Application")
    Err.Clear
    End If
      On Error GoTo Err_Handler
    
    oWdApp.Visible = True
    oWdApp.Activate
    Set oWdDoc = oWdApp.Documents.Add
    oWdDoc.Range.Text = "New Doc"
    
      Set oWdApp = Nothing
    Set oWdDoc = Nothing
    
    Exit Sub
    
    Err_Handler:
    MsgBox Err.Number & " " & Err.Description
    
    End Sub
    

    It runs and creates the new document on my system.

    Was this answer helpful?

    0 comments No comments