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 Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Save without code

Status
Not open for further replies.

shrubble

MIS
Jul 23, 2003
300
US
I'm writing a VBA project in Visio, which more or less functions like the rest of MS VBA environments, and I've got something that has me stumped:

After the program executes, I want to save a copy of the document with a new file name (that's a piece of cake), but I don't want the new, saved doc to carry all of the VBA code with it (just want a plain old doc).

Any ideas?

"I would rather have a free bottle in front of me, than a pre-frontal lobotomy..."

-Shrubble
 
plain old doc" - do you mean, plain old Visio file?
In any case, do a Ctrl-A (CopyAll), make new blank file, then Paste. Save that file. Contents are copied, VBA is not.



Gerry
 
Not sure if it'll work in Visio but if it has the same VBE structure then it should:
thread707-871741

Did a search on
vbproject delete module

and it came up with a bunch of other hits as well

Rgds, Geoff

"Three things are certain: Death, taxes and lost data. Guess which has occurred"

Please read FAQ222-2244 before you ask a question
 
Here's what I did, it's kinda silly but it works:

After the VBA code fires, it creates and saves the new document using a very particular naming convention. I added some code into the document_opened event that basically checks the name of the file to see if it's the template or a renamed file.

If it's the template, the code fires, if not, it doesn't.

I wouldn't use this solution if the VBA modules were substantial, but as it stands now the code only adds about 20kb to the file size.

Thanks for the help folks!

"I would rather have a free bottle in front of me, than a pre-frontal lobotomy..."

-Shrubble
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top