Solved

Running Visio Macro from VBS File

Posted on 2016-10-28
3
74 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 79

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 49

Accepted Solution

by:
Rgonzo1971 earned 500 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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

The ability to add structure to Visio diagrams using containers, lists and callouts is one of my favorite features in Visio 2010. In this article we’ll examine lists. We’ll explore containers and callouts in separate articles. Prior to reading th…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
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…

776 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