Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3234642
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T17:24:55+00:00 2026-05-17T17:24:55+00:00

I want to create a visio page, add some shapes, store it with a

  • 0

I want to create a visio page, add some shapes, store it with a given filename and close it.

Currently, always the object/template toolbar is active and thus stored under the given filename.

What is the best way to store the current drawing?
thanks

Dim visioApp, visioPage as Object
Set visioApp = CreateObject("visio.application")

visioApp.Documents.AddEx ("")      
Set visioPage = visioApp.ActiveWindow.Page
Set visioStencil = visioApp.Documents.Add("BASFLO_M.VSS")

' add shapes

visioApp.ActiveDocument.SaveAs ("c:\.......vsd")
visioApp.ActiveDocument.Close
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T17:24:56+00:00Added an answer on May 17, 2026 at 5:24 pm

    As you point out, when you open the stencil the active document changes. You can change it back to the document you are editing like this:

    Set visioApp = CreateObject("visio.application")
    
    visioApp.Documents.AddEx ("")
    Set visioPage = visioApp.ActiveWindow.Page
    
    ' Remember which window is active '
    Set visioWindow = visioApp.ActiveWindow
    
    Set visioStencil = visioApp.Documents.Add("BASFLO_M.VSS")
    
    ' Reactivate the drawing window '
    visioWindow.Activate
    
    visioPage.Drop visioStencil.Masters(1), 4, 4
    
    visioApp.ActiveDocument.SaveAs "c:\temp\mydoc.vsd"
    visioApp.ActiveDocument.Close
    

    You could also use a reference to the document object you created and not rely on the active document:

    Set visioApp = CreateObject("visio.application")
    
    ' Get a reference to the docment you are creating'
    Set visioDoc = visioApp.Documents.AddEx("")
    Set visioPage = visioApp.ActiveWindow.Page
    Set visioStencil = visioApp.Documents.Add("BASFLO_M.VSS")
    
    visioPage.Drop visioStencil.Masters(1), 4, 4
    
    ' Use the document object, not the active document '
    visioDoc.SaveAs "c:\temp\mydoc1.vsd"
    visioDoc.Close
    

    I have one last suggestion. Instead of creating a new document and then a stencil I suggest you create a new document based on the Basic Flowchart template. By doing this you create a document with all the same default settings for grid, fonts, etc as the Basic Flowchart you would create if you selected that template in the user interface. Another benefit of using the template is that the flowchart stencils will be opened in the document’s workspace every time the document you create is reopened. Try this:

    Set visioApp = CreateObject("visio.application")
    
    ' BASFLO_M.VST is the filename of the Basic Flowchart Template (metric) '
    Set visioDoc = visioApp.Documents.Add("BASFLO_M.VST")
    Set visioPage = visioApp.ActiveWindow.Page
    
    ' The stencil will be already open as part of the BASFLO_M.VST workspace '
    Set visioStencil = visioApp.Documents("BASFLO_M.VSS")
    
    visioPage.Drop visioStencil.Masters(1), 4, 5
    visioPage.Drop visioStencil.Masters(1), 5, 4
    
    visioDoc.SaveAs "c:\temp\mydoc2.vsd"
    visioDoc.Close
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just want to create plugin that will when visitor(user,visitor,...) visit some post,remember what
I want to create a JSP page or servlet that will work in 2
I want create a drop shadow around the canvas component in flex. Technically speaking
I want create a excel with Apache POI in java and I must insert
i want create image animation , i have 50 images with png format now
I want create module which update list of usb devices automatically (not only mass
I am trying ebook reading app. In that I want create UIActionSheet by clicking
I want to create a textbox which text binds an integer (e.g 123456789), but
I want to create a php variable depending on what was selected in a
I want to create 5 variables of type array all at once. Is this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.