[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Running Visio Macro from VBS File

Posted on 2016-10-28
3
Medium Priority
?
260 Views
Last Modified: 2016-11-01
Hi,

I have the following inside a VBS/VB Script. This code runs in regular environment but when inside a VBS file, it is not running

Option Explicit
MacroExample

Sub MacroExample()

    Set AppVisio = CreateObject("visio.application")
    Dim vsoDoc As Visio.Document

    Set vsoDoc = AppVisio.Documents.Open("\\edcfs2\share2\nathsh\XenApp\Desktop\Drawing1.vsd")

    vsoDoc.ExecuteLine ("PageSel")
    Set vsoDoc = Nothing

End Sub

Open in new window


At the moment I am triggering it with a batch file - this code is tested to run 'hi world' function

 cscript \\edcfs2\share2\nathsh\XenApp\Desktop\Test\Temp\filename.vbs

Open in new window


Any help on resolving/pointing in the right direction is appreciated!
0
Comment
Question by:Shanan212
3 Comments
 
LVL 84

Expert Comment

by:David Johnson, CD, MVP
ID: 41865329
vbscript and VBA are not the same they are related but not the same
1
 
LVL 54

Accepted Solution

by:
Rgonzo1971 earned 2000 total points
ID: 41865419
Hi,

pls try
Option Explicit
MacroExample

Sub MacroExample()

    Set AppVisio = CreateObject("visio.application")
    Dim vsoDoc

    Set vsoDoc = AppVisio.Documents.Open("\\edcfs2\share2\nathsh\XenApp\Desktop\Drawing1.vsd")

    vsoDoc.ExecuteLine ("PageSel")
    Set vsoDoc = Nothing

End Sub

Open in new window

Regards
0
 
LVL 13

Author Closing Comment

by:Shanan212
ID: 41869253
Thanks!
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Windows Explorer let you handle zip folders nearly as any other folder: Copy, move, change, and delete, etc. In VBA you can also handle normal files and folders, but zip folders takes a little more - and that you'll find here.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question