Add-in for Visio 2000

K

Knut Haugerud

I've been running around in circles now for the last few days, and I hope
someone can help me on a way to a proper solution.

I need to be able to create a toolbar to appear in Visio 2000 every time the
application loads. I have the code that produces the toolbar, the only
problem is that I have to run the VBA code manually from the VBA environment
if I want to see it.

After reading through most of the content on msdn, I have figured out that I
have to write a COM add-in for Visio ... so far so good. What I can't find,
is examples on how I can write a very simple COM add-in for Visio 2000 using
either VB or VBA. Does someone have a small sample that e.g. pops up a note
in a MsgBox every time Visio loads ?

I can, from what I understand, write the COM add-in in either VB or VBA. To
write the add-in in VBA, I have to use Office Developer, which I do not
have, so I guess the solution have to be that I code it in VB ?!

Thanx,
Knut
 
K

Knut Haugerud

I have tried to create a .vsd file with the following code:

Sub Auto_Load()
MsgBox "Hello ..."
End Sub

saved it, and put it under the "Startup" folder under Program Files\Visio,
but nothing happens :-(

I have to manually go into the VBA environment to start the Sub

/Knut
 
R

Randall Arnold

Sorry-- the "Auto_Load" was a mistake on my part. Auto_Open was correct,
but I found out after I posted that it's been obsoleted by Application- and
Document-level events.

Anyway, after looking into it further, I believe the Visio Document object
supports the methods and events you need. The following subs may help:

Private Sub Document_DocumentCreated(ByVal doc As IVDocument)
'some code goes here
End Sub

Private Sub Document_DocumentOpened(ByVal doc As IVDocument)
'some code goes here
End Sub

Give them a try! Just enable the Developer toolbar (Under View menu item)
and start a document. Then go to the VBA IDE window to view and use the
Document object.

Randall Arnold
 
K

Knut Haugerud

Hi,

thank you for the answer, but I'm afraid that it is not exactly what I am
looking for.

As I wrote in my first posting, I need to write a procedure that is run
*every* time the application start. The Document_DocumentOpened only runs
when the xx.vsd file is opened.

I have tried to use the 'Application_AppActivated' and
'Application_AppObjActivated' events, but they do not do the trick either.

Or am I doing something completely wrong ?

Regards,
Knut
 
K

Knut Haugerud

Hi Mark,

I have read this article several times, but it does not help me.

1) This is written for Visio 2002 ... not Visio 2000. As I can understand,
Visio 2000 does not support COM Add-Ins ?!
2) A have tried to modified and compile the code in the article (added a
MsgBox in the OnConnection event), registered the dll, startet Visio, but
.... nothing
3) When I look at the first screendump in the article, I do not have the
"Microsoft Visio" option in the "Application" field.

/Knut
 
K

Knut Haugerud

Hi Randall,

The Application events does not fire at all. The Document events fire when I
open the .vsd file, but as I have mentioned ... that does not solve my
problem ... I need to execute the subs on application start.

:-(

/Knut
 
R

Randall Arnold

You've verified for sure that the App events don't fire? Maybe try sticking
a debugging statement or a msgbox call in it? Because if App-level events
aren't firing, but Doc-level events are, that seems really weird. Maybe
there's something in the MS Knowledge base about that...?

Randall Arnold
 
K

Knut Haugerud

Hi Mark,

I have read this article several times, but it does not help me.

1) This is written for Visio 2002 ... not Visio 2000. As I can understand,
Visio 2000 does not support COM Add-Ins ?!
2) A have tried to modified and compile the code in the article (added a
MsgBox in the OnConnection event), registered the dll, startet Visio, but
.... nothing
3) When I look at the first screendump in the article, I do not have the
"Microsoft Visio" option in the "Application" field.

/Knut
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top