Visio Guy

Visio Discussions => Programming & Code => Topic started by: Jumpy on December 10, 2009, 07:18:41 AM

Title: Start Macro on Visio Start
Post by: Jumpy on December 10, 2009, 07:18:41 AM
Hello all,

there's an entry called "Start" at Extras->Options->More Options->Button "File Paths".
visguy: Tools > Options > Advanced > File Paths... > Start-up

(I have german Visio and only translatetd above locations. The real english name may be different).

The help says, that in this path you could save Macros and Add-Ons that will start automatic when Visio is started.

Has anyone tried this? How do I save Makros there? I tried to export a Modul to a *.bas file and saved it there, but nothing happened.

I need this Info (related to another topic, where no answers came) to force Visio to start only with a certain template.
Title: Re: Start Macro on Visio Start
Post by: Visio Guy on December 10, 2009, 03:16:30 PM
Hi Jumpy,

I couldn't get vba inside of Visio files to work, nor VBS files. But .exes work just fine.

For example, you can put a copy of the Visio Event Monitor Tool (http://visualsignals.typepad.co.uk/vislog/2008/06/using-the-visio-event-monitor-tool.html) in your "Vis Startup" directory, and it will fire when Visio starts.

I'm sure if you can get COM add-ins to go off using this structure, or if that is even necessary. I find that a lot of the utilities I create work better as .exes anyway. No VBA code being copied everywhere, and no hassle with setup and publishing that add-ins cause.
Title: Re: Start Macro on Visio Start
Post by: Jumpy on December 11, 2009, 07:06:28 AM
As .exe means, I have to write sth. in C++ or #???

I just started learning plain C in school.

Or is it possible to save a VBA as .exe, too? With Visual Studio perhaps?
Title: Re: Start Macro on Visio Start
Post by: Visio Guy on December 11, 2009, 09:24:11 AM
I make .exes in Visual Studio using C# or VB.NET.

Hmm, maybe I should write another article - simple example of programming Visio using Visual Studio. There are plenty of examples in the Visio SDK, but sometimes people need a story on how to get started.
Title: Re: Start Macro on Visio Start
Post by: wapperdude on December 11, 2009, 03:20:15 PM
Go for it!  Your "stories" are great.   ;D  Besides, unless an individual is "hunting" or "on-a-mission", some aspects of Visio don't "suggest themselves" nor their usefulness.   :P  ???  That's where your "Tales of Visio" come in.  They bring you in, and then, the light goes on.   :o
Title: Re: Start Macro on Visio Start
Post by: Jumpy on December 11, 2009, 07:40:02 PM
I would like that, too. To see one time how it is done and why.
After that it is easier to use that for other situations, because I hopefully have understood how it works.
Title: Re: Start Macro on Visio Start
Post by: Yacine on November 06, 2010, 10:05:29 AM
Hi Jumpy,
I wonder what solution you chose at the end. I do need myself to solve exactly the same problem. Would appreciate if you share it.

Chris, did you happen to write that article yet?
Title: Re: Start Macro on Visio Start
Post by: Jumpy on November 08, 2010, 01:47:31 PM
Hi Yacine,

I made a empty drawing. Called it "Start.vsd".

It's in a folder that is know to Visio in the Dialog

Tools > Options > Advanced > File Paths > Drawings

I created a new Desktop-Link to Visio, went to properties and entered the filename behind the execute statement.

Know, whenever you start Visio with that Desktop-Link, it will start with that drawing.

-------

That special Start.vsd drawing is mostly empty and contains only one macro for the Document_Opened event in the ThisDocumet modul.
The code there opens the template (does some things to it) and closes the Start.vsd file and so itself.

--------

Not very nice, but it works.
Browser ID: smf (is_webkit)
Templates: 1: Printpage (default).
Sub templates: 4: init, print_above, main, print_below.
Language files: 1: index+Modifications.english (default).
Style sheets: 0: .
Hooks called: 62 (show)
Files included: 25 - 925KB. (show)
Memory used: 767KB.
Tokens: post-login.
Cache hits: 7: 0.00098s for 22,300 bytes (show)
Cache misses: 1: (show)
Queries used: 9.

[Show Queries]