Delete project from DOC

B

Boris D.

How can I delete project from a DOC ?
I want to do it before SAVE AS to NOT to reproduce docs
with VBA
 
J

Jezebel

VBA code modules are normally attached to the template, not the document.
Unless you have deliberately added VBA components to the document itself,
you don't have a problem.

But in any case, you can refer to, and remove, the components of a VBA
project via the document's VBProject property --

with ActiveDocument.VBProject.VBComponents
.Remove .Item("Module1")
end with
 
G

Guest

Thank you really
But if the Project is protected I have an protection Error.
How can I unprotect the Project first ?
 
J

Jezebel

I've never found a way to do that from VB or VBA. In principle you should be
able to use SendKeys to provide the password; I've never managed to get that
to work. Easier is to keep the code in the template or in an add-in; then
the problem doesn't arise in the first place.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top