P
Pat Hartman \(MVP\)
I am an experienced Access VBA developer but the word object model has
defeated me. I need to do three things.
1. Document the macros in all the word documents in a folder.
2. Delete a particular macro from those documents (hopefully it always has
the same name).
3. During Automation from Access add the macro back in and have it run if
the document is printed.
Background. The client currently maintains two libraries of documents. One
is used with an excel application that automats word and fills bookmarks
with data. The other library is used for all other purposes. Maintaining
the separate libraries is quite an administrative burden and the client
would like to merge them. I am also replacing the Excel application with an
Access application that performs similar functions. Data capture (and
storage) and document printing after filling bookmarked fields. When the
documents are filled from the Access application, a macro that checks that
all bookmarks have data before allowing printing needs to run if the user
attempts to print the document. However, this macro is getting in the way
of other uses of the documents, hence the request to delete the existing
macro.
So far I have been able to print the names of the code modules with:
Application.VBE.VBProjects(1).VBComponents(i).Name
But, I can't drill down to the procedures within. Modules and macros are
exposed in the Access object model but they don't seem to be in the Word
object model. Can anyone help?
defeated me. I need to do three things.
1. Document the macros in all the word documents in a folder.
2. Delete a particular macro from those documents (hopefully it always has
the same name).
3. During Automation from Access add the macro back in and have it run if
the document is printed.
Background. The client currently maintains two libraries of documents. One
is used with an excel application that automats word and fills bookmarks
with data. The other library is used for all other purposes. Maintaining
the separate libraries is quite an administrative burden and the client
would like to merge them. I am also replacing the Excel application with an
Access application that performs similar functions. Data capture (and
storage) and document printing after filling bookmarked fields. When the
documents are filled from the Access application, a macro that checks that
all bookmarks have data before allowing printing needs to run if the user
attempts to print the document. However, this macro is getting in the way
of other uses of the documents, hence the request to delete the existing
macro.
So far I have been able to print the names of the code modules with:
Application.VBE.VBProjects(1).VBComponents(i).Name
But, I can't drill down to the procedures within. Modules and macros are
exposed in the Access object model but they don't seem to be in the Word
object model. Can anyone help?