• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1997
  • Last Modified:

MS Publisher, VBA sample macro from Microsoft creates Automation error

In a MS Publisher VBA module, I am trying to open an other Publisher instance. I found the attached sample code on the microsoft website. Unfortunately it does not work on my computer. Any ideas what I need to do to make it work?
Sub ModifyAnotherPublication()
    ' Create new instance of Publisher.
    Dim appPub As New Publisher.Application
 
    ' Open publication.
    appPub.Open Filename:="C:\Publication1.pub"
 
    ' Put code here to modify the publication as necessary.
 
    ' Close the publication.
    appPub.ActiveDocument.Close
 
    ' Release the other instance of Publisher.
    Set appPub = Nothing
End Sub

Open in new window

0
VB-tinkerer
Asked:
VB-tinkerer
1 Solution
 
VB-tinkererAuthor Commented:
I have not received a solution to this question.

However I managed to find a different way to create an other instance of MS Publisher. (see code below) So no further input is required.
Set pubApp = CreateObject("Publisher.Application")
With pubApp
   ....
   ....
End With

Open in new window

0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now