Visio Guy

Visio Discussions => Programming & Code => Topic started by: MacGyver on December 30, 2011, 05:01:43 PM

Title: Get Filename of Stencil
Post by: MacGyver on December 30, 2011, 05:01:43 PM
I have a macro contained within a stencil.  Is there a way to (within the macro) get the filename and filepath of the parent stencil without user input? 

I need to do this because the stencil filename changes with newer versions and I don't want to hard code the file name into the code and have to update this line of code with every new version of the stencil.  I'd also prefer not to have to ask the user for the stencil location every time i run the macro. 
Title: Re: Get Filename of Stencil
Post by: Paul Herber on December 30, 2011, 05:18:04 PM
Try
ThisDocument.Name

If the code is in the stencil then ThisDocument should refer to the stencil.
I haven't tried it.
Title: Re: Get Filename of Stencil
Post by: MacGyver on December 30, 2011, 05:35:56 PM
Perfect! Used the combination of ThisDocument.Path and ThisDocument.Name to achieve the full file path.

Thanks
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: 46 (show)
Files included: 25 - 922KB. (show)
Memory used: 769KB.
Tokens: post-login.
Cache hits: 6: 0.00082s for 22,291 bytes (show)
Cache misses: 1: (show)
Queries used: 8.

[Show Queries]