简体   繁体   中英

Visio macro to save a macro-free file

I have a series of complex charts to draw, so I have written a macro that takes a set of instructions from a CSV file and draws them appropriately. This works, but I need to manually save the produced page as a .vsdx file (ie without my macro code) after the fact.

What I'd like to do is specify the filename in the input file and have it produce a macro-free visio file of that name.

I've tried

Application.ActiveDocument.SaveAs filename

but this immediately generates a run-time error: "VB projects cannot be saved in macro-free files".

I understand that - I don't want my macro code in each of the (dozens of) flow charts I'm drawing. How can I suppress this error?

Thanks in advance.

If you want to have your macro(s) stored in a document file, then you'd want to have your macro generate a new document in which you draw your complex charts. But as @y4cine commented, you need to keep your code separate from your content, if you want to save your content as macro-free files.

Otherwise you may be able to set Application.AlertResponse to whatever response Visio asks interactively when you try to save a file that has a macro as a macro-free format.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM