Insert Documents with vba/Macros

Microsoft Office word 2007 (academic)
May 10, 2012 at 07:13:16
Specs: Windows XP, 6600/4GB
Hi,
I have a few Word Documents in 2007, and based on a form with check boxes, I insert all documents selected one after the other. All that is working. The only problem is that some of those documents have VBA/Macros in them that gets fired when a dropdown is selected, and I can't seem to be able to get those VBA/Macros imported when I insert those documents. Is there a way to do this, or am i doing it the wrong way? Thanks for your help!

See More: Insert Documents with vba/Macros

Report •


#1
May 10, 2012 at 07:50:20
It's not clear to me what you are "inserting" these Word documents into.

Click Here Before Posting Data or VBA Code ---> How To Post Data or Code.


Report •

#2
May 10, 2012 at 08:00:25
I have a Document Template (.dotm), it has Forms and VBA codes. I have some 30 different documents that needs to be put together depending on the check box selection. I just do a simple insert at the end of the current document for every check box selected. Once all documents are in one, the macros that were in some inserted document cannot be found. I think they get dropped when the document is inserted. Is there a way to import them too?

Report •

#3
May 10, 2012 at 08:54:13
I'm pretty good with Excel VBA, but Word is not one of my strengths, so I'm just taking a shot here:

You said:

"Once all documents are in one, the macros that were in some inserted document cannot be found."

Does that mean that some documents bring their macros with them and some don't?

If that's the case, I'd go back to the original documents and look carefully at how the macros are saved within the ones that work and the ones that don't. Maybe some are in Standard Modules and others are in the ThisDocument module or something like that.

That's just a guess.

You could try posting your question here, being as specific as you were in your second post so that they have a clear understanding of your situation.

https://groups.google.com/group/mic...

Click Here Before Posting Data or VBA Code ---> How To Post Data or Code.


Report •

Related Solutions

#4
May 10, 2012 at 09:32:54
Here is what's going on in a simply way:

I have a document template and some 30 other documents. Each documents
have dropdown and text boxes controlled by VBA/Macros.

Within the template, I have a form with 30 check boxes that let them
select which documents to insert. Once selected, I look at every check
boxes and if it is selected, I insert that specific document at the
end of the current document. I keep doing this for all check boxes. So
the final document can be fairly long.

Once the document is created, the user must fill all dropdowns and
text boxes. But I found out that when inserting those documents, I
lose all VBA/Macros; meaning they are not imported when I do the
insert. So I lost all the programming for those dropdown and text
boxes.

Is there a way to get the code inserted along with the document? Or is
there an easier solution? Thanks for your help!


Report •

#5
May 10, 2012 at 09:50:02
As I said, my Word VBA skills are not that strong.

You have now clarified that none of the documents are retaining the VBA code as opposed some like you said before.

I can not help you with that issue. As I mentioned before, you might want to try and post your question at the link below, where there are lot more Word experts than in this forum.

https://groups.google.com/group/mic...

Click Here Before Posting Data or VBA Code ---> How To Post Data or Code.


Report •


Ask Question