Solved

Running Visio Macro from VBS File

Posted on 2016-10-28
3
139 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 81

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 51

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

Industry Leaders: 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

This article is the result of a quest to better understand Task Scheduler 2.0 and all the newer objects available in vbscript in this version over  the limited options we had scripting in Task Scheduler 1.0.  As I started my journey of knowledge I f…
Introduction: Recently, I got a requirement to zip all files individually with batch file script in Windows OS. I don't know much about scripting, but I searched Google and found a lot of examples and websites to complete my task. Finally, I was ab…
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…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…

729 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