Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  HOME    TRACKER    Visual Basic

Visio Events

I am writing a program that interacts with Visio (2002). I would like to capture the Shape Double click event, to do some stuff in my VB program, but I don't know how. It is not in the object model, and I can't find it in the Event sink. The shape has got the EventDblClick event in shapesheet, where you can probably run a piece of VBA or VSL, but I want to run VB code when the event occurs.

I have tried to set the behaviour of double click to text edit, and then to capture the beforetextedit event. The problem is, that if I change the Shape.Text in that event code, I get a Server Exception, and Visio doesn't want to close, I have to end task.

Please, any help/comments/suggestions welcome!

View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Project And Visio API (VBA)- Using Milestones In Project To Create A Visio Timeline
I have a problem here and I hope someone will be able to assist me.

I have a bunch of milestones in project and I would like to select a few of the milestones and create a visio timeline for it. I know 2007 has an option to import the whole project file to create a timeline but I just want the selected milestones to appear. Is there a way?

I got a feedback from someone and I'd like to share it with you guys to see if it works.

"This sounds like it would require some custom code using the Project and Visio APIs, perhaps in VBA. I don't think it would be terribly complicated- get the selected milestones in Project, copy their attributes, drop a timeline shape in Visio, drop some milestones on it, and configure the milestones using the Project milestones' attributes."

Is anyone able to write it since I am VB illiterate (Well I have some knowledge).

Vb6 Exe Does Not Fire Events From Standalone Mode, But Fires Events When It Runs In Vb6ide
Hi all,
I have a problem in VB6. When i run the application from the vb6 ide, it works fine and gets the events from the COM dll it works with. However, when I make an exe of the application and run it no this exe does not receive any events from the COM dll. Any help greatly appreciated.

Can You React To Events Using APIs Similarly To VB6 Form Events, Etc

Please excuse this question if it is laughably ignorant. I am having trouble trapping the Tab key on a VB6 form. Since all of the controls have their own hwnds, I was wondering if there was anything I could do with an API and child windows to determine when it changed.

I have worked with APIs only a very little bit, so please bear with me on this one if possible. Thanks in advance!

Have a great day!

How To Handle Grid_click Events Vs Grid_mousedown Events
I'm new to Visual Basic, but have done event-driven programming before, using a different IDE.

I'm maintaining a program running under Win 98, that is using a msFlexGrid control.

When the user left-clicks on a cell, I want specific actions to be taken, depending on the cell. I've got this part working just the way I want it.

However, I've discovered that If the user right-clicks on a cell, something undesireable happens.

All of the processing for the desired events (left clicks) are handled in grid_click().

I need to detect if the right mouse button is being pressed, and ignore them.

I've decided to create a breakpoint in grid_MouseDown(), to see if grid_MouseDown() was called before grid_click(), since grid_click is always called, regardless of the right or left button is pressed.

When I set a breakpoint in grid_MouseDown(), the breakpoint in grid_click() never occurs, and vice-versa.

I know I have some fundamental mis-conceptions about event handling, but I don't know what.

Would someone please help me out ?



Visio Help
hello i have developed an application in VB6 to open visio and put a picture into Visio. i am interested in learning how to do this effeciently but i can not get my code to work.
with my code i get the following error
Visio can not open the file for reading.

this is my code.

Private Sub cmdVisio_Click()
Dim vso As Visio.Application
Dim vsd As Visio.Document
Dim vsp As Visio.Page
Dim shp1Obj As Visio.Shape

Debug.Print FName
Set vso = New Visio.Application
Set vsd = vso.Documents.Open("H:SAMDrawingSAMDrawTest.vsd")
vso.Visible = True
Set vsp = vsd.Pages.Item(1)
'Change to reflect the path to a image on your system
Set shp1Obj = vsp.Import("H:SAMDrawingMountingW2Plates.bmp")

End Sub
i'm completely lost and would appreciate some help.

Visio And VB6
i donno where this would go so i asked it here

does any one know if it is possible to use VB6 to connect to Visio?

can i use visio with vb to draw dynamic charts and diagrams

VB6 And Visio
Anyone have any idea how to either:

1) Print to file from VB6 using the Visio Type Library (I want to print to a post script file), or,

2) Chnage the printer that VB prints to using the print method from the visio Type Library.


Visio And VB6
does any one know if it is possible to connect to Visio with VB6?

Visio HELP!!!

I created a stencil in Visio 2002, and I use it in a Visio document with. I want to change the behaviour of my shapes in the stencil to run a specific macro. The problem is that the macro is in the document code and not in the stencil's code.

If anybody can PLEASE help me or give any suggestions, I would appreciate it!


Visio In VB

If anybody can please help me ... I want to make an instance of Visio in my Vb or .Net program, and I don't know how to do it. I can't find an ocx that does this. I can use the Web browser control to display the visio document, but how do I save it?


Using Visio From VB
Dear all,

I am running into a situation where I must be able to access and create a
VISIO document, display figures and relationships based on data contained in
a VB program(extracted from excel).

Is there anyone who can refer me to appropriate documentation, ot similar
things done in VB?
Please advise
vest regards

VB And Visio
IS there a way to  Read a Visio diagram using VB/A?
I want to change the text of a visio file through some programming...
Any help is appreciated...

Using Visio SDK In VB

I would like to use Visio SDK for developing an application in VB
If someone has got any sample applications using the same, please share them with me


Visio Help
Hey You All Gurus,
Need some urgent help on cross-functional diagrams in visio.
If anyone done anything on this,please mail me back...i need something or the other to start with.I did visited microst site but did not get much information there.If anyone of you have worked with cross-functional diagrams...please let me know.
Thanks in Advance

Visio Help
Hello ,
Could you help me with the following problem i have while working in Visio.
When i drop a shape on the document, i want to trap its x & y co-ordinates, i know that you can see the values in shapesheet but i want to trap the values in visual basic, My problem is that i have draw a sketch of a Warehouse Management system in visio which has store houses,when i click on a particular store house i need to trap its x & y co-ordinate in Visual Basic, how do i do that using user defined functions (addins/macros).


MS VISIO - Automation

is it possible to make some Textfields in VISIO variable in order to modifiy the content?
I like to create a network drawing but want to make the description with the IP address variable.
I like to retrieve the IP addresses, etc. from a Source Table (ExcelFile). As soon as a value in this source table changes, the IP address in the drawing should be updated automatically.

I found the VBA is available in VISIO, but I cound't find a way to modify the textfield

Any idea how to do this?

Positioning In Visio From VB6
i have made an application that will open visio and put some drawings in it, from VB6. it works like i want it too but the only problem is that i can not position the drawings from VB6. i was doing some research and i found the Glueto and GlueToPos methods, and i think that is what i am looking for. but i am unsure of how to use them from VB6 so i was wondering if maybe some one knows how to use them?

Visio Table
i am such a novice at most of this stuff so i am wondering if some one could help me out. i need make a table in Visio. and i need to put some values into it with VB6. is this even possible?

VB And VISIO Question
I have VISIO 2002 on my computer along with VB6. I have found plenty of automation code and it works fine. I see Visio launch and I can control the objects and connectors just fine and save my final work to a file.

Now I want to deploy this application. I use the Pacakge and Deploy tool and get tons of errors on the client.

So, let me ask a basic question...does the client need to have Visio 2002 installed or will there be enough of the type library distributed in my setup?

Get me past this mental block and I can likely fix the errors. I actually see VISIO launch in development and wonder if that is what it would look like.

I know this sounds goofy, but all other Office interactions done in the past are with the standard Office products which are always on the client.

Oh, one thing that may influence your response...I did download the free Visio Viewer, but that is used after my application draws it.

Is there a runtime file that ships that makes it work like Access offers? Any help!

VISIO Automation
Can anyone point me towards information on reading visio files with vb? I am not sure if this is possible but things like reading data within shapes created in visio.

Visio Vba Menus

I'm quite new to VBA scripting and trying to code a new menu for Visio, yet I can't figure the darn thing out.

Can anyone give me sample code for a very simple menu and where exactly do I put this code? ThisDocument (Code)....form(Code)...or a new module?

Thanks in advance

Eg's Of Visio VBA Code
Can anyone give me a boot in the right direction to some examples of Visio VBA code? I'm new to Visio and would like to know the capabilities of this seemingly simple application!

Automating Visio
Has anyone ever automated the creation of shapes and connectors in Visio? I have no problem creating a shape and placing it on the drawing, however, I have searched and searched and I cannot find any code on how to draw a connector between two shapes that I have created. I think I have to do something with specifying which connector on the shape I would use, but I just cant figure it out. I am downloading the SDK to see if that has any examples.

Here is what I have for drawing the shapes onto the pages:

VB Code:
Option ExplicitDim x As New Visio.ApplicationPrivate Sub Command1_Click() 'Load my template, so I know the right stencils are loadedx.Documents.Add App.Path & "Default.vst" 'Create some shapesDim objSHape1 As Visio.ShapeDim objSHape2 As Visio.ShapeSet objSHape1 = TestDropShape("Process", 2, 2)Set objSHape2 = TestDropShape("Decision", 4, 2) '''How do I connect objShape1 and objShape2??'' 'Resize to fit what I have drawnx.ActiveDocument.Pages(1).ResizeToFitContents 'Show the visiox.Visible = True 'Free up the application objectSet x = NothingEnd Sub  Public Function TestDropShape(strName As String, dblTop As Double, dblLeft As Double) As Visio.ShapeDim stencil As Visio.Document, mstCircle As Visio.Master 'Get the stencil I want to useSet stencil = x.Documents.Item("Basic Flowchart Shapes (US units).vss") Set mstCircle = stencil.Masters(strName) Dim objShape As Visio.Shape'Drop the shape on the first pageSet objShape = x.ActiveDocument.Pages(1).Drop(mstCircle, dblTop, dblLeft)     'Set the text to some valueobjShape.Text = "A" 'Return the shapeSet TestDropShape = objShapeEnd Function

Visio 2003 And VB 6
visio 2003 attempts to add a toolbar to the IDE of vb6, and it causes vb to hang when attempting to open.

Anyone know which registry key I can poke at it to prevent the add in toolbars from loading in the VB6 IDE??

Visio Selection From VB6
hello, i have been able (with lots of help) to make shapes and position them in visio2000. but now what i need to do is be able to select more than one item and group them as one shape. any ideas?

Visio Table
i've tried a search and didn't find any results. i need to know if the following is possible.
i need to make a table in Visio using VB6. i have looked under "datagrid" and "Table" i can't seem to find what i am looking for. any help on this would be greatly appriciated

Positioning In Visio
i have made an application that will open visio and put some drawings in it, from VB6. it works like i want it too but the only problem is that i can not position the drawings from VB6. i was doing some research and i found the Glueto and GlueToPos methods, and i think that is what i am looking for. but i am unsure of how to use them from VB6 so i was wondering if maybe some one knows how to use them?

Visio Control
Hi all,

I am new to this forum and also new to coding. But what I'm trying to do is code up an .exe file to load and control MS-Visio. Can anyone please help me as I'm not sure as to how to go about this.

Thanks alot for your help!

Visio From VB Project
Does the Enterprise Edition of Microsoft Visio have some sort of control that can be used within a VB project to allow the enduser (of the VB exe) to draw diagrams and change properties of shapes, connections, etc? If so how do you install it; what is it called? Thanks for the help!

Visio Macros
How can i write a code that will save the document into 3 diff. types of format.(i.e .wmf,.txt,.vsd)?????

Help are greatly aprreciated!!!

Visio, Excel And VBA
Hi all. Any help at all here would be kindly appreciated. I'm a programmer by trade but haven't ever dealt with VB or VBA with the Office environment, so don't be affraid to be technical in the answer to the likely easy question. As it stands right now, I have a shape in Visio that I export to an Excel file that then runs the numbers through some calculations. The Excel file is linked into the same Visio file with the shape that gets exported, so after the export of the shape table I have to update the link to the Excel file to have the changes reflected in the Visio file as well. Right now this is all done through the menus which is tedious and not smoothe looking. I was wondering if there is any way to automate this process in Visio using VBA, i.e. to have the export and update done perhaps on a change event from the shapes, or the document. It'd be a super help if you could include some code snippets that I could follow. Failing it being possible, any other thoughts would be great (maybe importing the shape into Excel?). Thanks muchly!

Access VBA And Visio UML
I'm going to be very embarrased if I've posted this question multiple times, but the submit button didn't give me any feedback on my first post. This post i'm switching from Firefox to IE.

I'm trying to import the VBA from an Access (.mdb) app into Viso and generate UML diagrams. I don't know the specific steps for getting the code into Visio.

I can use the automated reverse engineering function in Visual Studio, but not for Access VBA.

Thank you for your help,


Visio Like Control
I need to create an application which has visio-like look and feel. A
graphical pad on the right 75% of the form and a toolbox on the left. Is
there a control available to create a graphical pad where I can drag/drop
and move objects from a toolbox, or would I have to create a control in

Any help with this would be appreciated.


Visio Shapes In VB 6.0
In a VB 6.0 project (on a form), I need to "draw" a diagram using Visio shapes objects. I already have installed Visio SDK, but I need code samples to show me what must be done !

Visio: Org. Chart
My problem is so simple.
I want to connect one subordinate ("position") to two superiors ("managers or positions") with a connector line.
Visio wouldn't let me do it.
There must be someting to do with shape's properties/behavior!!
Can somebody help?
Thanx, Fatih

Visio Problem
Hey Gurus,
What i am trying to do is embed an Visio OLE OBJECT in a word document.What i mean is that first i prog. create a visio
flowchart using the visio object model and then save that file.Later stage,i open the word object model and prog. inserts
the initially created visio file in the word as an OLE Object.Now things were working really fine and cool till i found a
REFLECTED IN how do i get the remaining pages....please advice,suggest,help as soon as possible as i need it
**** urgently.........THANKS IN ADVANCE.

S/W Developer

Visio Shape
Hello Guys.....
If any of you have worked with the VISIO object model,i need to know how to get the X and Y co-ordinates
of a shape when i have dropped the shape on the document.....
Please reply as soon as possible as urgent...

Siddharth S. Pawar
S/W Developer

Visio AlertReponse
Hello Guys....
The problem here is that when i use the visio object model....and drop shapes from stencil to a document,it pops
up a dialog box like "Do you want to set the Auto-Connect ,etc,etc".Now i have used the AlertResponse as per reading the
help to set my Default Option to YES..but its still not working and so i cannot move further.....please help me if any idea
as soon as possible..

Siddharth S. Pawar
S/W Developer

Org Charts In Visio
Hello Friends....
I want something really urgent....what i want to do is to show organisational charts in Visio.I have a table
which has a heirarachy of ID's....i mean the parent and childs.Now accessing these tables i want to make a org chart
using the Visio Object model...if anyone has worked on such thing....please send me some code in VB for refernce....
any help will be appreciated as i really need it urgently...
Thanks In Advance...

Siddharth S. Pawar
S/W Developer

Bitter About Visio
I just installed Visio on my workstation. It automatically adds a toolbar to the VB editor. I tried removing, editing, and deleting it, but i can't get rid of it. Does anyone know where the personalized settings for the VB toolbars are stored (registry?, .ini?, other?)? It's really getting on my nerves because it takes an extra line for itself.

thanx/good luck,

VBA Access And Visio
I'm working on an Access 97 application which driving Visio using automation technology.
When I try to print the document object, by using the 'Print' method, Access display the 438 error code (Property or Method unknown for this object...); Visio Development Help tells to enclose the 'Print' Keyword into Brackets to distinguish it as a Visio method but Access do not accept this syntax !
Please help me !
(see the portion of code below...)

Dim loDocVisio As Object
Set loDocVisio = poAppVisio.Documents.OpenEx("C:synopt.vsd", visOpenCopy)


Programming In Visio SDK

Can anyone help me in using Visio SDK with VB to retrieve data from a Access Database table and present the information graphically.


Selectable Toolbox (like Visio)
I am investigating how to write an app which has a toolbox of selectable items. I will need to place them on the 'canvas' and be able to resize them and type text in them.

Just like you can with visio (for those of you who have used it)

Anyone got any ideas. I have asked this question on a few other forums but no-one has been able to come up with a workable answer.

Visio 2002. Tutorial For Using VBA?
Can anyone direct me to a tutorial on using VBA for Visio 2002.
I am specifically interested in using VBA to add and edit custom properties to shapes.

Any help will be appreciated.


Visio VBA - Disabling Accelerators
I am trying to secure our Visio solution on the web and I've only got a couple more issues left. A previous issue of mine was that I could not disable the Alt-F11 accelerator to prevent remote users from entering VBA mode, but I found code on the MSDN to help me with that. My biggest problem now is very similar, now I need to disable Ctrl-O. Our solution will be accessible over the web using Terminal Services and if the user can use the open function then they will be able to access our local files. At the bottom of this post I have pasted the code needed to disable Alt-F11 from your solution but I can not figure out the Ctrl-O. I have tried deleting the following accelerators and none of them seem to disable Ctrl-O.


Removing an accelerator (From MSDN)

The following macro shows how to delete the accelerator for the Visual Basic Editor from the drawing window context.

Sub DeleteAccelItem( )
Dim uiObj As Visio.UIObject
Dim accelTableObj As Visio.AccelTable
Dim accelItemsObj As Visio.AccelItems
Dim accelItemObj As Visio.AccelItem
Dim i As Integer

'Retrieve the UIObject object for the copy of the built-in menus.
Set uiObj = Visio.Application.BuiltInMenus

'Set accelTableObj to the Drawing menu set.
Set accelTableObj = uiObj.AccelTables.ItemAtID(visUIObjSetDrawing)

'Retrieve the accelerator items collection.
Set accelItemsObj = accelTableObj.AccelItems

'Retrieve the accelerator item for the Visual Basic Editor by iterating
'through the accelerator items collection and locating the item you want to delete.
For i = 0 To accelItemsObj.Count - 1
Set accelItemObj = accelItemsObj.Item(i)
If accelItemObj.CmdNum = Visio.visCmdToolsRunVBE Then
Exit For
End If
Next i

'Delete the accelerator.

'Tell Visio to use the new custom menus while the document is active.
ThisDocument.SetCustomMenus uiObj

End Sub

Pasted from <>

If anyone can assist me with this issue it would be greatly appreciated.

Nick Hewitt
Paisley Systems

How Can I Send Information From Visio To Vb?
i am looking for a way to send information from visio vba to visual basic.


Draw Arrow In Visio ?
i looking for a code in vba (in visio) that draw an arrow


Visio Mouse Event
I want to implement mousemove and mouseleave events on my visio document so when I point to a shape (e.g. rectangle) it changes in color....

Copyright 2005-08, All rights reserved