Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

in VB6 Call a Visio Macro

Status
Not open for further replies.

NewGuy

Programmer
Dec 28, 2000
31
CA
I am trying to do some AUTOMATION for Visio.

I have created a program that updates an Access Database that VISIO uses.

I have also figured out how to open a Visio map that pulls that data from the db.

I can not find out how to call a Macro in the Visio file from VB6. I want the program to run the DataBase Update menu option for the Visio map.

Calling a Visio Macro from a VB6 program must be totally top secret or never tried before, there is nothing on the web about it.

Can "ANYONE" help at all?????
 
I've just knocked this up from VB to test the principle, so not error-trapped production code!!
[tt]
Set visApp = CreateObject("Visio.Application")
Set visDoc = visApp.Documents.Open("c:\test.vsd")
visApp.Visible = True
Call visApp.ActiveDocument.macro1
[/tt]

The Visio macro is just:
[tt]
Sub macro1()
With ThisDocument.Pages("Page-1")
.DrawRectangle(1, 1, 5, 5) = x
End With
End Sub
[/tt]

Don't forget to tidy up in VB when you're done with
[tt]
visApp.Quit
Set visDoc = Nothing
Set xisApp = Nothing
[/tt]

Hope that gets you started!

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'If we're supposed to work in Hex, why have we only got A fingers?'
 
Wow. It is amazing how the simplest of things looked so difficult to me.

I have managed to get it working.

Thank you......
 
Hi Guys,

I need a simply way to open a visio chart (already prepared) with VB6, launch a WIZARD to update datas and save the document automatically with a given name.
Can anybody gimme an example?

Thx a lot
zp
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top