Insert a document into another document with a Form at startup 
Author Message
 Insert a document into another document with a Form at startup

Hi,

I work with Word97 and I want (in VBA) to insert a document (or rather a
document based on a template) into another document.
The document/template which i want to insert has a form when opening/adding
it. But when I insert this option (Document_new/open) does n't seem to work.

Can anybody help me?

Thanks,

Ellen van S{*filter*}is



Mon, 05 Jan 2004 20:12:45 GMT  
 Insert a document into another document with a Form at startup
Hallo Ellen,

Your observation is correct, the file_new event isn't triggered when a file
is inserted instead of opened.
The suitable workaround would depend a bit on why you need two documents in
the first place. Can't you just use autotext for example?
Otherwise the path to explore would be to take over Word's builtin command
Insert - File by creating a macro named InsertFile with your own code.
You could create an invisable document that the user picked from the dialog,
get it's attached template path and filename and start your macro from
there. All this is possible with VBA but is not a real straight forward
task. I don't know how familair you are with VBA but maybe these links would
be a good place to check some things:

"Intercepting events like Save and Print"
http://www.*-*-*.com/

"How to open a document invisibly to the user"
http://www.*-*-*.com/

"Getting help with calling Word's built-in dialogs using VBA"
http://www.*-*-*.com/

Once again all this is possible in theory but if it's the right way really
depends on what it is you're after. Maybe you can post back with a more
detailed explanation?

Hope this helps,
Groeten!
Astrid

So that all can benefit from the discussion, please post all follow-ups to
the newsgroup.
Visit the MVP Word FAQ site at http://www.*-*-*.com/



Quote:
> Hi,

> I work with Word97 and I want (in VBA) to insert a document (or rather a
> document based on a template) into another document.
> The document/template which i want to insert has a form when
opening/adding
> it. But when I insert this option (Document_new/open) does n't seem to
work.

> Can anybody help me?

> Thanks,

> Ellen van S{*filter*}is



Tue, 06 Jan 2004 09:25:14 GMT  
 Insert a document into another document with a Form at startup
Hi Astrid,

Thanks for your answer.
Let met start with explaning what I want.
I have a template with a userform for making a cover page. I also have a
template for making a report. Sometimes this report needs to start with the
coverpage.
So I want to make a button in the reporttemplate to insert the coverpage,
with userform to fill out the coverpage.
I could make a button to start a new document based on the
coverpagetemplate, but I want the coverpage to be saved in the report
document.

Ik hope I made myself clear!

Thanks

Ellen



Quote:
> Hallo Ellen,

> Your observation is correct, the file_new event isn't triggered when a
file
> is inserted instead of opened.
> The suitable workaround would depend a bit on why you need two documents
in
> the first place. Can't you just use autotext for example?
> Otherwise the path to explore would be to take over Word's builtin command
> Insert - File by creating a macro named InsertFile with your own code.
> You could create an invisable document that the user picked from the
dialog,
> get it's attached template path and filename and start your macro from
> there. All this is possible with VBA but is not a real straight forward
> task. I don't know how familair you are with VBA but maybe these links
would
> be a good place to check some things:

> "Intercepting events like Save and Print"
> http://www.*-*-*.com/

> "How to open a document invisibly to the user"
> http://www.*-*-*.com/

> "Getting help with calling Word's built-in dialogs using VBA"
> http://www.*-*-*.com/

> Once again all this is possible in theory but if it's the right way really
> depends on what it is you're after. Maybe you can post back with a more
> detailed explanation?

> Hope this helps,
> Groeten!
> Astrid

> So that all can benefit from the discussion, please post all follow-ups to
> the newsgroup.
> Visit the MVP Word FAQ site at http://www.*-*-*.com/



> > Hi,

> > I work with Word97 and I want (in VBA) to insert a document (or rather a
> > document based on a template) into another document.
> > The document/template which i want to insert has a form when
> opening/adding
> > it. But when I insert this option (Document_new/open) does n't seem to
> work.

> > Can anybody help me?

> > Thanks,

> > Ellen van S{*filter*}is



Tue, 06 Jan 2004 21:04:01 GMT  
 Insert a document into another document with a Form at startup
Hi Ellen,

Ook uit Nederland he?
I think the easiest solution is to store the coverpage inside an
autotextentry. Just add the bookmarks and everything in it.
In your template built two userforms, one for the coverpage and for the
report. In your autonew macro either
- start with asking first if the user need a cover page, if yes, show both
forms and fill the entire document
or
- start the form that builds the report and add a button to the toolbar that
starts a macro that inserts the autotextentry of the coverpage as the
startposition of your document and shows the form to fill it.

Hope this helps,
regards,
Astrid

So that all can benefit from the discussion, please post all follow-ups to
the newsgroup.
Visit the MVP Word FAQ site at http://www.*-*-*.com/



Quote:
> Hi Astrid,

> Thanks for your answer.
> Let met start with explaning what I want.
> I have a template with a userform for making a cover page. I also have a
> template for making a report. Sometimes this report needs to start with
the
> coverpage.
> So I want to make a button in the reporttemplate to insert the coverpage,
> with userform to fill out the coverpage.
> I could make a button to start a new document based on the
> coverpagetemplate, but I want the coverpage to be saved in the report
> document.

> Ik hope I made myself clear!

> Thanks

> Ellen



> > Hallo Ellen,

> > Your observation is correct, the file_new event isn't triggered when a
> file
> > is inserted instead of opened.
> > The suitable workaround would depend a bit on why you need two documents
> in
> > the first place. Can't you just use autotext for example?
> > Otherwise the path to explore would be to take over Word's builtin
command
> > Insert - File by creating a macro named InsertFile with your own code.
> > You could create an invisable document that the user picked from the
> dialog,
> > get it's attached template path and filename and start your macro from
> > there. All this is possible with VBA but is not a real straight forward
> > task. I don't know how familair you are with VBA but maybe these links
> would
> > be a good place to check some things:

> > "Intercepting events like Save and Print"
> > http://www.*-*-*.com/

> > "How to open a document invisibly to the user"
> > http://www.*-*-*.com/

> > "Getting help with calling Word's built-in dialogs using VBA"
> > http://www.*-*-*.com/

> > Once again all this is possible in theory but if it's the right way
really
> > depends on what it is you're after. Maybe you can post back with a more
> > detailed explanation?

> > Hope this helps,
> > Groeten!
> > Astrid

> > So that all can benefit from the discussion, please post all follow-ups
to
> > the newsgroup.
> > Visit the MVP Word FAQ site at http://www.*-*-*.com/



> > > Hi,

> > > I work with Word97 and I want (in VBA) to insert a document (or rather
a
> > > document based on a template) into another document.
> > > The document/template which i want to insert has a form when
> > opening/adding
> > > it. But when I insert this option (Document_new/open) does n't seem to
> > work.

> > > Can anybody help me?

> > > Thanks,

> > > Ellen van S{*filter*}is



Tue, 06 Jan 2004 22:28:22 GMT  
 Insert a document into another document with a Form at startup
Hi Astrid,

Ja klopt, lastig he dat Engels??

Thanks again!
Because the coverpagetemplate is also being used seperatly, I was hoping
there was a way to use the coverpagetemplate on its own as well as in the
reporttemplate.
But it seems that is n't possible, so i'll do it your way!

Thanks.

Ellen



Quote:
> Hi Ellen,

> Ook uit Nederland he?
> I think the easiest solution is to store the coverpage inside an
> autotextentry. Just add the bookmarks and everything in it.
> In your template built two userforms, one for the coverpage and for the
> report. In your autonew macro either
> - start with asking first if the user need a cover page, if yes, show both
> forms and fill the entire document
> or
> - start the form that builds the report and add a button to the toolbar
that
> starts a macro that inserts the autotextentry of the coverpage as the
> startposition of your document and shows the form to fill it.

> Hope this helps,
> regards,
> Astrid

> So that all can benefit from the discussion, please post all follow-ups to
> the newsgroup.
> Visit the MVP Word FAQ site at http://www.*-*-*.com/



> > Hi Astrid,

> > Thanks for your answer.
> > Let met start with explaning what I want.
> > I have a template with a userform for making a cover page. I also have a
> > template for making a report. Sometimes this report needs to start with
> the
> > coverpage.
> > So I want to make a button in the reporttemplate to insert the
coverpage,
> > with userform to fill out the coverpage.
> > I could make a button to start a new document based on the
> > coverpagetemplate, but I want the coverpage to be saved in the report
> > document.

> > Ik hope I made myself clear!

> > Thanks

> > Ellen



> > > Hallo Ellen,

> > > Your observation is correct, the file_new event isn't triggered when a
> > file
> > > is inserted instead of opened.
> > > The suitable workaround would depend a bit on why you need two
documents
> > in
> > > the first place. Can't you just use autotext for example?
> > > Otherwise the path to explore would be to take over Word's builtin
> command
> > > Insert - File by creating a macro named InsertFile with your own code.
> > > You could create an invisable document that the user picked from the
> > dialog,
> > > get it's attached template path and filename and start your macro from
> > > there. All this is possible with VBA but is not a real straight
forward
> > > task. I don't know how familair you are with VBA but maybe these links
> > would
> > > be a good place to check some things:

> > > "Intercepting events like Save and Print"
> > > http://www.*-*-*.com/

> > > "How to open a document invisibly to the user"
> > > http://www.*-*-*.com/

> > > "Getting help with calling Word's built-in dialogs using VBA"
> > > http://www.*-*-*.com/

> > > Once again all this is possible in theory but if it's the right way
> really
> > > depends on what it is you're after. Maybe you can post back with a
more
> > > detailed explanation?

> > > Hope this helps,
> > > Groeten!
> > > Astrid

> > > So that all can benefit from the discussion, please post all
follow-ups
> to
> > > the newsgroup.
> > > Visit the MVP Word FAQ site at http://www.*-*-*.com/



> > > > Hi,

> > > > I work with Word97 and I want (in VBA) to insert a document (or
rather
> a
> > > > document based on a template) into another document.
> > > > The document/template which i want to insert has a form when
> > > opening/adding
> > > > it. But when I insert this option (Document_new/open) does n't seem
to
> > > work.

> > > > Can anybody help me?

> > > > Thanks,

> > > > Ellen van S{*filter*}is



Tue, 06 Jan 2004 23:20:53 GMT  
 Insert a document into another document with a Form at startup
Hi Ellen,

Quote:
> Because the coverpagetemplate is also being used seperatly, I was hoping
> there was a way to use the coverpagetemplate on its own as well as in the
> reporttemplate.
> But it seems that is n't possible, so i'll do it your way!

Everything is possible!
The real question is: how much code are you willing to spend on it ;-)

Another alternative could be to store them both in one template as
autotextentries and ask the users first which one - or both - they want to
use.

Hope this helps,
regards,
Astrid

So that all can benefit from the discussion, please post all follow-ups to
the newsgroup.
Visit the MVP Word FAQ site at http://www.mvps.org/word/



Thu, 08 Jan 2004 01:02:31 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. VBA code to print all icon-inserted documents within a document

2. Macro to insert text or document into active document

3. Inserting Documents in Forms

4. ActiveX to insert a Word document in a outlook form

5. How can I insert a Word Document into a Word Document like a INSERT/FILE ??

6. How can I insert a Word Document into a Word Document like a INSERT/FILE ??

7. Document Window or Document Type

8. Updating Documents Created From a Master Document Template

9. Disabling document blank space before close document

10. How to create a shortcut or alias to the document upon saving the document

11. Create New Document and Copy Table from Existing Document

12. Document(#) vs Document("Name")

 

 
Powered by phpBB® Forum Software