Quantcast
Channel: VBForums - ASP, VB Script
Viewing all articles
Browse latest Browse all 688

Call publisher macro from vbscript

$
0
0
Hi,

I want to call a publisher macro using vbscript. I can open an existing publisher file using the script. But when i try to call the macro using "Run" command, it say "Invalid function".

Following is the code I am trying to run.

Option Explicit
Dim xlApp1, xlApp2, xlBook
Set xlApp1 = CreateObject("Excel.Application")
Set xlApp2 = CreateObject("Publisher.Application")
Set xlBook = xlApp1.Workbooks.Open("C:\Users\Pramod\Desktop\BRICS Weekly\BRICS Weekly.xlsm", 0, True)
xlApp1.Run "Process"
xlApp2.Open "C:\Users\Pramod\Desktop\BRICS Weekly\BRICS Global Markets Weekly Digest Template.pub"
xlApp2.Run "Generate_Pub"
Set xlBook = Nothing
Set xlApp1 = Nothing
WScript.Echo "Finished."
WScript.Quit

Can anyone please help.

PG

Viewing all articles
Browse latest Browse all 688

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>