Get Filename of Stencil

Started by MacGyver, December 30, 2011, 05:01:43 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

MacGyver

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. 

Paul Herber

Try
ThisDocument.Name

If the code is in the stencil then ThisDocument should refer to the stencil.
I haven't tried it.
Electronic and Electrical engineering, business and software stencils for Visio -

https://www.paulherber.co.uk/

MacGyver

Perfect! Used the combination of ThisDocument.Path and ThisDocument.Name to achieve the full file path.

Thanks

Browser ID: smf (is_webkit)
Templates: 4: index (default), Display (default), GenericControls (default), GenericControls (default).
Sub templates: 6: init, html_above, body_above, main, body_below, html_below.
Language files: 4: index+Modifications.english (default), Post.english (default), Editor.english (default), Drafts.english (default).
Style sheets: 4: index.css, attachments.css, jquery.sceditor.css, responsive.css.
Hooks called: 171 (show)
Files included: 32 - 1216KB. (show)
Memory used: 1043KB.
Tokens: post-login.
Cache hits: 13: 0.00396s for 26,582 bytes (show)
Cache misses: 2: (show)
Queries used: 16.

[Show Queries]