making VBA (userform) in a different template available in normal.

R

Ralf

Hi guys,

Let me sketch the situation for you:

What I have:

- a 'sales.dot' template with auto text fields and a userform which inserts
pieces of text in the template when certain options are clicked on the
userform

What I need:

- since I use a piece of CRM software that, when a new offer has to be made,
makes an empty .doc file (from normal.dot I presume) I import the above .dot
template as a file (import > file) to have Word import certain data from the
database connected to the CRM software to auto merge fields. Although this
gives the document the proper look, it doesn't import the userform I've made
in that specific .dot template. When I import the sales.dot file into the
..doc, I need it to also import the userform and VBA attached to the .dot

What I know:
I've read about at least using the sales.dot file I made into the add-ins in
Word so it loads on startup. Other than that, I've read that I need to call
upon the userform in normal.dot to actually make it work with any templates I
import as a file.

Is there another way about this, or do I need to write an additional script
for the normal.dot file to make this work? Also to keep in mind is that I'm
not the only one who will be using the document, so that might mean
normal.dot has to be adapted on the PCs of all users or through storing a
..dot on a network location.

I hope you can help!

Sincerely,

Ralf
 
D

Doug Robbins - Word MVP

Why aren't you creating the documents by selecting New from the File menu
and then selecting the Sales.dot template as the basis for the document that
you want to create?

--
Hope this helps,

Doug Robbins - Word MVP

Please reply only to the newsgroups unless you wish to obtain my services on
a paid professional basis.
 
R

Ralf

Hello Doug,

Thanks for the response. Our CRM software creates a WORD document with a
referencenumber that is then stored on the server so it can be called upon
from the CRM software. In other words, we need to work with the document that
the CRM software initializes. The only way that I know of to use a template
with it, is to insert > file the .dot template.

If I make a new document with the template, it won't have the reference
number. And it can't be renamed because the document with that number already
exists. (so the CRM software would never be able to call upon the document
because it only stores the documents with the right reference numbers under
the projects of customers. (the software is Navision)
 
D

Doug Robbins - Word MVP

If you use the following code to attach your template to the document that
has been created, the macros in Sales.dot will be available for use with
that document.

ActiveDocument.AttachedTemplate = "[path]\Sales.dot"

replace [path] with the appropriate Drive:\Path

--
Hope this helps,

Doug Robbins - Word MVP

Please reply only to the newsgroups unless you wish to obtain my services on
a paid professional basis.
 
R

Ralf

Hello Doug,

Thanks for this. Should it put this in my normal.dot? Because the new
documents that are generated are all empty and therefore originating from my
normal.dot.

Can you give any tips as to how I would do this with multiple people working
on the same documents? Should I replace the normal.dot on every instance of
MS Word in the office that needs to use the document?

Ty so much.

Greetings,

Ralf

Doug Robbins - Word MVP said:
If you use the following code to attach your template to the document that
has been created, the macros in Sales.dot will be available for use with
that document.

ActiveDocument.AttachedTemplate = "[path]\Sales.dot"

replace [path] with the appropriate Drive:\Path

--
Hope this helps,

Doug Robbins - Word MVP

Please reply only to the newsgroups unless you wish to obtain my services on
a paid professional basis.

Ralf said:
Hello Doug,

Thanks for the response. Our CRM software creates a WORD document with a
referencenumber that is then stored on the server so it can be called upon
from the CRM software. In other words, we need to work with the document
that
the CRM software initializes. The only way that I know of to use a
template
with it, is to insert > file the .dot template.

If I make a new document with the template, it won't have the reference
number. And it can't be renamed because the document with that number
already
exists. (so the CRM software would never be able to call upon the document
because it only stores the documents with the right reference numbers
under
the projects of customers. (the software is Navision)
 
D

Doug Robbins - Word MVP

If you were to put

Sub Autonew()
ActiveDocument.AttachedTemplate = "[path]\Sales.dot"
End Sub

in the normal.dot template, it would attach the Sales.dot template to all
documents created from the Normal.dot template.

In addition, if the CRM software is any good, it may well include a command
that prevents auto macros from running so that they do not interfere with
what it wants to be done. Plus, screwing around with a user's normal.dot
template is like fiddling around with their underwear.

What I would do is create a macro containing the
ActiveDocument.AttachedTemplate command in a template that was distributed
to users and saved into their Word Startup folder and have toolbar in that
template that contained a button to run the code. Then when the user
creates a document via the CRM, they could click on that button to attach
the template. You could also then include in the code the commands to call
the userform.
--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com

Ralf said:
Hello Doug,

Thanks for this. Should it put this in my normal.dot? Because the new
documents that are generated are all empty and therefore originating from
my
normal.dot.

Can you give any tips as to how I would do this with multiple people
working
on the same documents? Should I replace the normal.dot on every instance
of
MS Word in the office that needs to use the document?

Ty so much.

Greetings,

Ralf

Doug Robbins - Word MVP said:
If you use the following code to attach your template to the document
that
has been created, the macros in Sales.dot will be available for use with
that document.

ActiveDocument.AttachedTemplate = "[path]\Sales.dot"

replace [path] with the appropriate Drive:\Path

--
Hope this helps,

Doug Robbins - Word MVP

Please reply only to the newsgroups unless you wish to obtain my services
on
a paid professional basis.

Ralf said:
Hello Doug,

Thanks for the response. Our CRM software creates a WORD document with
a
referencenumber that is then stored on the server so it can be called
upon
from the CRM software. In other words, we need to work with the
document
that
the CRM software initializes. The only way that I know of to use a
template
with it, is to insert > file the .dot template.

If I make a new document with the template, it won't have the reference
number. And it can't be renamed because the document with that number
already
exists. (so the CRM software would never be able to call upon the
document
because it only stores the documents with the right reference numbers
under
the projects of customers. (the software is Navision)

:

Why aren't you creating the documents by selecting New from the File
menu
and then selecting the Sales.dot template as the basis for the
document
that
you want to create?

--
Hope this helps,

Doug Robbins - Word MVP

Please reply only to the newsgroups unless you wish to obtain my
services
on
a paid professional basis.

Hi guys,

Let me sketch the situation for you:

What I have:

- a 'sales.dot' template with auto text fields and a userform which
inserts
pieces of text in the template when certain options are clicked on
the
userform

What I need:

- since I use a piece of CRM software that, when a new offer has to
be
made,
makes an empty .doc file (from normal.dot I presume) I import the
above
.dot
template as a file (import > file) to have Word import certain data
from
the
database connected to the CRM software to auto merge fields.
Although
this
gives the document the proper look, it doesn't import the userform
I've
made
in that specific .dot template. When I import the sales.dot file
into
the
.doc, I need it to also import the userform and VBA attached to the
.dot

What I know:
I've read about at least using the sales.dot file I made into the
add-ins
in
Word so it loads on startup. Other than that, I've read that I need
to
call
upon the userform in normal.dot to actually make it work with any
templates I
import as a file.

Is there another way about this, or do I need to write an additional
script
for the normal.dot file to make this work? Also to keep in mind is
that
I'm
not the only one who will be using the document, so that might mean
normal.dot has to be adapted on the PCs of all users or through
storing
a
.dot on a network location.

I hope you can help!

Sincerely,

Ralf
 
R

Ralf

Hello Doug,

After some trial and error, I think I'm lost.

I'm trying to get to work the userform in an empty new document first of all
and then take it to step two, where you say I'm best off just making a macro
in a template.

I have a couple of questions/problems:

- Can I place

Sub Autonew()
ActiveDocument.AttachedTemplate = "[path]\Sales.dot"
End Sub

in ThisDocument of a random new document created from normal.dot to call
upon the template and be able to have the userform pop up?

- Do I then still need to call upon the sales.dot template in the Add-ins in
Word?
- Do I still have to put a Private Sub Document_New() in ThisDocument of the
sales.dot template? Or does this have the same function as the script you
posted previously?
- When I activate sales.dot in the empty new document and go into the visual
basic project the template is locked even though it's not password protected
or write protected.
- How do you go about making a macro button in Word to call upon the
template in a new document?

Thank you in advance.

Ralf



Doug Robbins - Word MVP said:
If you were to put

Sub Autonew()
ActiveDocument.AttachedTemplate = "[path]\Sales.dot"
End Sub

in the normal.dot template, it would attach the Sales.dot template to all
documents created from the Normal.dot template.

In addition, if the CRM software is any good, it may well include a command
that prevents auto macros from running so that they do not interfere with
what it wants to be done. Plus, screwing around with a user's normal.dot
template is like fiddling around with their underwear.

What I would do is create a macro containing the
ActiveDocument.AttachedTemplate command in a template that was distributed
to users and saved into their Word Startup folder and have toolbar in that
template that contained a button to run the code. Then when the user
creates a document via the CRM, they could click on that button to attach
the template. You could also then include in the code the commands to call
the userform.
--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com

Ralf said:
Hello Doug,

Thanks for this. Should it put this in my normal.dot? Because the new
documents that are generated are all empty and therefore originating from
my
normal.dot.

Can you give any tips as to how I would do this with multiple people
working
on the same documents? Should I replace the normal.dot on every instance
of
MS Word in the office that needs to use the document?

Ty so much.

Greetings,

Ralf

Doug Robbins - Word MVP said:
If you use the following code to attach your template to the document
that
has been created, the macros in Sales.dot will be available for use with
that document.

ActiveDocument.AttachedTemplate = "[path]\Sales.dot"

replace [path] with the appropriate Drive:\Path

--
Hope this helps,

Doug Robbins - Word MVP

Please reply only to the newsgroups unless you wish to obtain my services
on
a paid professional basis.

Hello Doug,

Thanks for the response. Our CRM software creates a WORD document with
a
referencenumber that is then stored on the server so it can be called
upon
from the CRM software. In other words, we need to work with the
document
that
the CRM software initializes. The only way that I know of to use a
template
with it, is to insert > file the .dot template.

If I make a new document with the template, it won't have the reference
number. And it can't be renamed because the document with that number
already
exists. (so the CRM software would never be able to call upon the
document
because it only stores the documents with the right reference numbers
under
the projects of customers. (the software is Navision)

:

Why aren't you creating the documents by selecting New from the File
menu
and then selecting the Sales.dot template as the basis for the
document
that
you want to create?

--
Hope this helps,

Doug Robbins - Word MVP

Please reply only to the newsgroups unless you wish to obtain my
services
on
a paid professional basis.

Hi guys,

Let me sketch the situation for you:

What I have:

- a 'sales.dot' template with auto text fields and a userform which
inserts
pieces of text in the template when certain options are clicked on
the
userform

What I need:

- since I use a piece of CRM software that, when a new offer has to
be
made,
makes an empty .doc file (from normal.dot I presume) I import the
above
.dot
template as a file (import > file) to have Word import certain data
from
the
database connected to the CRM software to auto merge fields.
Although
this
gives the document the proper look, it doesn't import the userform
I've
made
in that specific .dot template. When I import the sales.dot file
into
the
.doc, I need it to also import the userform and VBA attached to the
.dot

What I know:
I've read about at least using the sales.dot file I made into the
add-ins
in
Word so it loads on startup. Other than that, I've read that I need
to
call
upon the userform in normal.dot to actually make it work with any
templates I
import as a file.

Is there another way about this, or do I need to write an additional
script
for the normal.dot file to make this work? Also to keep in mind is
that
I'm
not the only one who will be using the document, so that might mean
normal.dot has to be adapted on the PCs of all users or through
storing
a
.dot on a network location.

I hope you can help!

Sincerely,

Ralf
 
D

Doug Robbins - Word MVP

On my system, in the templates folder, I have a template with the name of
FormsizerDemo.dotm that contains a module with the name of ModWords and in
that module is Sub RunWords that contains the commands to display a userform
that is in the FormsizerDemo.dotm

Then, in a template that is saved in the Word Startup Folder, I have the
following macro:

Sub FormSizer()
ActiveDocument.AttachedTemplate =
"C:\Users\Doug\AppData\Roaming\Microsoft\Templates\FormsizerDemo.dotm"
Application.Run "ModWords.RunWords"

End Sub

Now, if I create a new blank document (from the Normal template) and then
run the macro FormSizer (which is available because the template in which it
is located is in the Startup folder, it attaches the FormSizerDemo template
to the blank document and displays the userform that is called by the
RunWords macro in the FormsizerDemo.dotm template.

If I was wanting to do this all of the time, I would put a button to run the
FormSizer macro on the Ribbon (in Word 2007) or on a toolbar in earlier
versions.

In your case, the Sales.dot would take the place of FormsizerDemo.dotm in
the above example and in the template that is stored in the startup folder,
you would have a macro that attached that template to the document that was
active when it was run using

ActiveDocument.AttachedTemplate = "[path]\sales.dot"
Application.Run "[modulename].[macroname]"

to display the userform that is in sales.dot where the modulename is the
name of the module in sales.dot that contains the macro ([macroname]) that
causes the userform to be displayed.


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com

Ralf said:
Hello Doug,

After some trial and error, I think I'm lost.

I'm trying to get to work the userform in an empty new document first of
all
and then take it to step two, where you say I'm best off just making a
macro
in a template.

I have a couple of questions/problems:

- Can I place

Sub Autonew()
ActiveDocument.AttachedTemplate = "[path]\Sales.dot"
End Sub

in ThisDocument of a random new document created from normal.dot to call
upon the template and be able to have the userform pop up?

- Do I then still need to call upon the sales.dot template in the Add-ins
in
Word?
- Do I still have to put a Private Sub Document_New() in ThisDocument of
the
sales.dot template? Or does this have the same function as the script you
posted previously?
- When I activate sales.dot in the empty new document and go into the
visual
basic project the template is locked even though it's not password
protected
or write protected.
- How do you go about making a macro button in Word to call upon the
template in a new document?

Thank you in advance.

Ralf



Doug Robbins - Word MVP said:
If you were to put

Sub Autonew()
ActiveDocument.AttachedTemplate = "[path]\Sales.dot"
End Sub

in the normal.dot template, it would attach the Sales.dot template to all
documents created from the Normal.dot template.

In addition, if the CRM software is any good, it may well include a
command
that prevents auto macros from running so that they do not interfere with
what it wants to be done. Plus, screwing around with a user's normal.dot
template is like fiddling around with their underwear.

What I would do is create a macro containing the
ActiveDocument.AttachedTemplate command in a template that was
distributed
to users and saved into their Word Startup folder and have toolbar in
that
template that contained a button to run the code. Then when the user
creates a document via the CRM, they could click on that button to attach
the template. You could also then include in the code the commands to
call
the userform.
--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com

Ralf said:
Hello Doug,

Thanks for this. Should it put this in my normal.dot? Because the new
documents that are generated are all empty and therefore originating
from
my
normal.dot.

Can you give any tips as to how I would do this with multiple people
working
on the same documents? Should I replace the normal.dot on every
instance
of
MS Word in the office that needs to use the document?

Ty so much.

Greetings,

Ralf

:

If you use the following code to attach your template to the document
that
has been created, the macros in Sales.dot will be available for use
with
that document.

ActiveDocument.AttachedTemplate = "[path]\Sales.dot"

replace [path] with the appropriate Drive:\Path

--
Hope this helps,

Doug Robbins - Word MVP

Please reply only to the newsgroups unless you wish to obtain my
services
on
a paid professional basis.

Hello Doug,

Thanks for the response. Our CRM software creates a WORD document
with
a
referencenumber that is then stored on the server so it can be
called
upon
from the CRM software. In other words, we need to work with the
document
that
the CRM software initializes. The only way that I know of to use a
template
with it, is to insert > file the .dot template.

If I make a new document with the template, it won't have the
reference
number. And it can't be renamed because the document with that
number
already
exists. (so the CRM software would never be able to call upon the
document
because it only stores the documents with the right reference
numbers
under
the projects of customers. (the software is Navision)

:

Why aren't you creating the documents by selecting New from the
File
menu
and then selecting the Sales.dot template as the basis for the
document
that
you want to create?

--
Hope this helps,

Doug Robbins - Word MVP

Please reply only to the newsgroups unless you wish to obtain my
services
on
a paid professional basis.

Hi guys,

Let me sketch the situation for you:

What I have:

- a 'sales.dot' template with auto text fields and a userform
which
inserts
pieces of text in the template when certain options are clicked
on
the
userform

What I need:

- since I use a piece of CRM software that, when a new offer has
to
be
made,
makes an empty .doc file (from normal.dot I presume) I import the
above
.dot
template as a file (import > file) to have Word import certain
data
from
the
database connected to the CRM software to auto merge fields.
Although
this
gives the document the proper look, it doesn't import the
userform
I've
made
in that specific .dot template. When I import the sales.dot file
into
the
.doc, I need it to also import the userform and VBA attached to
the
.dot

What I know:
I've read about at least using the sales.dot file I made into the
add-ins
in
Word so it loads on startup. Other than that, I've read that I
need
to
call
upon the userform in normal.dot to actually make it work with any
templates I
import as a file.

Is there another way about this, or do I need to write an
additional
script
for the normal.dot file to make this work? Also to keep in mind
is
that
I'm
not the only one who will be using the document, so that might
mean
normal.dot has to be adapted on the PCs of all users or through
storing
a
.dot on a network location.

I hope you can help!

Sincerely,

Ralf
 
R

Ralf

Let me show you what I have so far:


- Sales.dot contains a form called 'Salesform' and I've inserted the
following code into ThisDocument of sales.dot:

Sub Document_open()
Salesform.Show
End Sub

This might be unnecessary, but I thought I'd at least post I've left this
piece of script in.


- Salesform in Sales.dot contains:

Sub Userform_Initialize()
**Contents**
End Sub




- I have inserted a template "call.dot" into the Word Startup folder with
the following contents:

Sub FormSizer()
ActiveDocument.AttachedTemplate = "F:\##\##\##\##\sales.dot" (network drive
for the template for access to more users)
Application.Run "Salesform.Userform_Initialize()"
End Sub


The macro shows up in Word and I've been able to make a button for running
it as well. The

Macro isn't running though. It pops up an error box without a message.

I suspest I'm not understanding the "Application.Run
"Salesform.Userform_Initialize()" bit correctly and have done something wrong
there, but I can't quite put my finger on it.

Doug Robbins - Word MVP said:
On my system, in the templates folder, I have a template with the name of
FormsizerDemo.dotm that contains a module with the name of ModWords and in
that module is Sub RunWords that contains the commands to display a userform
that is in the FormsizerDemo.dotm

Then, in a template that is saved in the Word Startup Folder, I have the
following macro:

Sub FormSizer()
ActiveDocument.AttachedTemplate =
"C:\Users\Doug\AppData\Roaming\Microsoft\Templates\FormsizerDemo.dotm"
Application.Run "ModWords.RunWords"

End Sub

Now, if I create a new blank document (from the Normal template) and then
run the macro FormSizer (which is available because the template in which it
is located is in the Startup folder, it attaches the FormSizerDemo template
to the blank document and displays the userform that is called by the
RunWords macro in the FormsizerDemo.dotm template.

If I was wanting to do this all of the time, I would put a button to run the
FormSizer macro on the Ribbon (in Word 2007) or on a toolbar in earlier
versions.

In your case, the Sales.dot would take the place of FormsizerDemo.dotm in
the above example and in the template that is stored in the startup folder,
you would have a macro that attached that template to the document that was
active when it was run using

ActiveDocument.AttachedTemplate = "[path]\sales.dot"
Application.Run "[modulename].[macroname]"

to display the userform that is in sales.dot where the modulename is the
name of the module in sales.dot that contains the macro ([macroname]) that
causes the userform to be displayed.


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com

Ralf said:
Hello Doug,

After some trial and error, I think I'm lost.

I'm trying to get to work the userform in an empty new document first of
all
and then take it to step two, where you say I'm best off just making a
macro
in a template.

I have a couple of questions/problems:

- Can I place

Sub Autonew()
ActiveDocument.AttachedTemplate = "[path]\Sales.dot"
End Sub

in ThisDocument of a random new document created from normal.dot to call
upon the template and be able to have the userform pop up?

- Do I then still need to call upon the sales.dot template in the Add-ins
in
Word?
- Do I still have to put a Private Sub Document_New() in ThisDocument of
the
sales.dot template? Or does this have the same function as the script you
posted previously?
- When I activate sales.dot in the empty new document and go into the
visual
basic project the template is locked even though it's not password
protected
or write protected.
- How do you go about making a macro button in Word to call upon the
template in a new document?

Thank you in advance.

Ralf



Doug Robbins - Word MVP said:
If you were to put

Sub Autonew()
ActiveDocument.AttachedTemplate = "[path]\Sales.dot"
End Sub

in the normal.dot template, it would attach the Sales.dot template to all
documents created from the Normal.dot template.

In addition, if the CRM software is any good, it may well include a
command
that prevents auto macros from running so that they do not interfere with
what it wants to be done. Plus, screwing around with a user's normal.dot
template is like fiddling around with their underwear.

What I would do is create a macro containing the
ActiveDocument.AttachedTemplate command in a template that was
distributed
to users and saved into their Word Startup folder and have toolbar in
that
template that contained a button to run the code. Then when the user
creates a document via the CRM, they could click on that button to attach
the template. You could also then include in the code the commands to
call
the userform.
--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com

Hello Doug,

Thanks for this. Should it put this in my normal.dot? Because the new
documents that are generated are all empty and therefore originating
from
my
normal.dot.

Can you give any tips as to how I would do this with multiple people
working
on the same documents? Should I replace the normal.dot on every
instance
of
MS Word in the office that needs to use the document?

Ty so much.

Greetings,

Ralf

:

If you use the following code to attach your template to the document
that
has been created, the macros in Sales.dot will be available for use
with
that document.

ActiveDocument.AttachedTemplate = "[path]\Sales.dot"

replace [path] with the appropriate Drive:\Path

--
Hope this helps,

Doug Robbins - Word MVP

Please reply only to the newsgroups unless you wish to obtain my
services
on
a paid professional basis.

Hello Doug,

Thanks for the response. Our CRM software creates a WORD document
with
a
referencenumber that is then stored on the server so it can be
called
upon
from the CRM software. In other words, we need to work with the
document
that
the CRM software initializes. The only way that I know of to use a
template
with it, is to insert > file the .dot template.

If I make a new document with the template, it won't have the
reference
number. And it can't be renamed because the document with that
number
already
exists. (so the CRM software would never be able to call upon the
document
because it only stores the documents with the right reference
numbers
under
the projects of customers. (the software is Navision)

:

Why aren't you creating the documents by selecting New from the
File
menu
and then selecting the Sales.dot template as the basis for the
document
that
you want to create?

--
Hope this helps,

Doug Robbins - Word MVP

Please reply only to the newsgroups unless you wish to obtain my
services
on
a paid professional basis.

Hi guys,

Let me sketch the situation for you:

What I have:

- a 'sales.dot' template with auto text fields and a userform
which
inserts
pieces of text in the template when certain options are clicked
on
the
userform

What I need:

- since I use a piece of CRM software that, when a new offer has
to
be
made,
makes an empty .doc file (from normal.dot I presume) I import the
above
.dot
template as a file (import > file) to have Word import certain
data
from
the
database connected to the CRM software to auto merge fields.
Although
this
gives the document the proper look, it doesn't import the
userform
I've
made
in that specific .dot template. When I import the sales.dot file
into
the
.doc, I need it to also import the userform and VBA attached to
the
.dot

What I know:
I've read about at least using the sales.dot file I made into the
add-ins
in
Word so it loads on startup. Other than that, I've read that I
need
to
call
upon the userform in normal.dot to actually make it work with any
templates I
import as a file.

Is there another way about this, or do I need to write an
additional
script
for the normal.dot file to make this work? Also to keep in mind
is
that
I'm
not the only one who will be using the document, so that might
mean
normal.dot has to be adapted on the PCs of all users or through
storing
a
.dot on a network location.

I hope you can help!

Sincerely,

Ralf
 
D

Doug Robbins - Word MVP

From sales.dot, delete

Sub Document_open()
Salesform.Show
End Sub

and insert a module into it, which by default will be named Module1. In
that module, create a macro

Sub ShowForm()
Dim myForm As Salesform

Set myForm = New SalesForm
myForm.Show vbModal
Unload myForm
Set myForm = Nothing

End Sub

In Call.dot, change the macro to:

Sub SalesFormShow()
ActiveDocument.AttachedTemplate = "F:\##\##\##\##\sales.dot"
Application.Run "Module1.ShowForm"
End Sub



--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com

Ralf said:
Let me show you what I have so far:


- Sales.dot contains a form called 'Salesform' and I've inserted the
following code into ThisDocument of sales.dot:

Sub Document_open()
Salesform.Show
End Sub

This might be unnecessary, but I thought I'd at least post I've left this
piece of script in.


- Salesform in Sales.dot contains:

Sub Userform_Initialize()
**Contents**
End Sub




- I have inserted a template "call.dot" into the Word Startup folder with
the following contents:

Sub FormSizer()
ActiveDocument.AttachedTemplate = "F:\##\##\##\##\sales.dot" (network
drive
for the template for access to more users)
Application.Run "Salesform.Userform_Initialize()"
End Sub


The macro shows up in Word and I've been able to make a button for running
it as well. The

Macro isn't running though. It pops up an error box without a message.

I suspest I'm not understanding the "Application.Run
"Salesform.Userform_Initialize()" bit correctly and have done something
wrong
there, but I can't quite put my finger on it.

Doug Robbins - Word MVP said:
On my system, in the templates folder, I have a template with the name of
FormsizerDemo.dotm that contains a module with the name of ModWords and
in
that module is Sub RunWords that contains the commands to display a
userform
that is in the FormsizerDemo.dotm

Then, in a template that is saved in the Word Startup Folder, I have the
following macro:

Sub FormSizer()
ActiveDocument.AttachedTemplate =
"C:\Users\Doug\AppData\Roaming\Microsoft\Templates\FormsizerDemo.dotm"
Application.Run "ModWords.RunWords"

End Sub

Now, if I create a new blank document (from the Normal template) and then
run the macro FormSizer (which is available because the template in which
it
is located is in the Startup folder, it attaches the FormSizerDemo
template
to the blank document and displays the userform that is called by the
RunWords macro in the FormsizerDemo.dotm template.

If I was wanting to do this all of the time, I would put a button to run
the
FormSizer macro on the Ribbon (in Word 2007) or on a toolbar in earlier
versions.

In your case, the Sales.dot would take the place of FormsizerDemo.dotm in
the above example and in the template that is stored in the startup
folder,
you would have a macro that attached that template to the document that
was
active when it was run using

ActiveDocument.AttachedTemplate = "[path]\sales.dot"
Application.Run "[modulename].[macroname]"

to display the userform that is in sales.dot where the modulename is the
name of the module in sales.dot that contains the macro ([macroname])
that
causes the userform to be displayed.


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com

Ralf said:
Hello Doug,

After some trial and error, I think I'm lost.

I'm trying to get to work the userform in an empty new document first
of
all
and then take it to step two, where you say I'm best off just making a
macro
in a template.

I have a couple of questions/problems:

- Can I place

Sub Autonew()
ActiveDocument.AttachedTemplate = "[path]\Sales.dot"
End Sub

in ThisDocument of a random new document created from normal.dot to
call
upon the template and be able to have the userform pop up?

- Do I then still need to call upon the sales.dot template in the
Add-ins
in
Word?
- Do I still have to put a Private Sub Document_New() in ThisDocument
of
the
sales.dot template? Or does this have the same function as the script
you
posted previously?
- When I activate sales.dot in the empty new document and go into the
visual
basic project the template is locked even though it's not password
protected
or write protected.
- How do you go about making a macro button in Word to call upon the
template in a new document?

Thank you in advance.

Ralf



:

If you were to put

Sub Autonew()
ActiveDocument.AttachedTemplate = "[path]\Sales.dot"
End Sub

in the normal.dot template, it would attach the Sales.dot template to
all
documents created from the Normal.dot template.

In addition, if the CRM software is any good, it may well include a
command
that prevents auto macros from running so that they do not interfere
with
what it wants to be done. Plus, screwing around with a user's
normal.dot
template is like fiddling around with their underwear.

What I would do is create a macro containing the
ActiveDocument.AttachedTemplate command in a template that was
distributed
to users and saved into their Word Startup folder and have toolbar in
that
template that contained a button to run the code. Then when the user
creates a document via the CRM, they could click on that button to
attach
the template. You could also then include in the code the commands to
call
the userform.
--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com

Hello Doug,

Thanks for this. Should it put this in my normal.dot? Because the
new
documents that are generated are all empty and therefore originating
from
my
normal.dot.

Can you give any tips as to how I would do this with multiple people
working
on the same documents? Should I replace the normal.dot on every
instance
of
MS Word in the office that needs to use the document?

Ty so much.

Greetings,

Ralf

:

If you use the following code to attach your template to the
document
that
has been created, the macros in Sales.dot will be available for use
with
that document.

ActiveDocument.AttachedTemplate = "[path]\Sales.dot"

replace [path] with the appropriate Drive:\Path

--
Hope this helps,

Doug Robbins - Word MVP

Please reply only to the newsgroups unless you wish to obtain my
services
on
a paid professional basis.

Hello Doug,

Thanks for the response. Our CRM software creates a WORD document
with
a
referencenumber that is then stored on the server so it can be
called
upon
from the CRM software. In other words, we need to work with the
document
that
the CRM software initializes. The only way that I know of to use
a
template
with it, is to insert > file the .dot template.

If I make a new document with the template, it won't have the
reference
number. And it can't be renamed because the document with that
number
already
exists. (so the CRM software would never be able to call upon the
document
because it only stores the documents with the right reference
numbers
under
the projects of customers. (the software is Navision)

:

Why aren't you creating the documents by selecting New from the
File
menu
and then selecting the Sales.dot template as the basis for the
document
that
you want to create?

--
Hope this helps,

Doug Robbins - Word MVP

Please reply only to the newsgroups unless you wish to obtain my
services
on
a paid professional basis.

Hi guys,

Let me sketch the situation for you:

What I have:

- a 'sales.dot' template with auto text fields and a userform
which
inserts
pieces of text in the template when certain options are
clicked
on
the
userform

What I need:

- since I use a piece of CRM software that, when a new offer
has
to
be
made,
makes an empty .doc file (from normal.dot I presume) I import
the
above
.dot
template as a file (import > file) to have Word import certain
data
from
the
database connected to the CRM software to auto merge fields.
Although
this
gives the document the proper look, it doesn't import the
userform
I've
made
in that specific .dot template. When I import the sales.dot
file
into
the
.doc, I need it to also import the userform and VBA attached
to
the
.dot

What I know:
I've read about at least using the sales.dot file I made into
the
add-ins
in
Word so it loads on startup. Other than that, I've read that I
need
to
call
upon the userform in normal.dot to actually make it work with
any
templates I
import as a file.

Is there another way about this, or do I need to write an
additional
script
for the normal.dot file to make this work? Also to keep in
mind
is
that
I'm
not the only one who will be using the document, so that might
mean
normal.dot has to be adapted on the PCs of all users or
through
storing
a
.dot on a network location.

I hope you can help!

Sincerely,

Ralf
 
R

Ralf

Hello Doug,

I get the feeling that I'm one step closer to getting it working.

The showform macro works correctly. The showSalesform macro in the call.dot
doesn't work it seems. I can call the showform macro when i open the template
sales.dot and it will show the form. In an empty new document, when only
call.dot is loaded as an add-in from the startup folder, I get an error when
I try to run showSalesform. I've checked consistency of caps and so on, so I
don't think that's the problem.

Thanks,

Ralf

Doug Robbins - Word MVP said:
From sales.dot, delete

Sub Document_open()
Salesform.Show
End Sub

and insert a module into it, which by default will be named Module1. In
that module, create a macro

Sub ShowForm()
Dim myForm As Salesform

Set myForm = New SalesForm
myForm.Show vbModal
Unload myForm
Set myForm = Nothing

End Sub

In Call.dot, change the macro to:

Sub SalesFormShow()
ActiveDocument.AttachedTemplate = "F:\##\##\##\##\sales.dot"
Application.Run "Module1.ShowForm"
End Sub



--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com

Ralf said:
Let me show you what I have so far:


- Sales.dot contains a form called 'Salesform' and I've inserted the
following code into ThisDocument of sales.dot:

Sub Document_open()
Salesform.Show
End Sub

This might be unnecessary, but I thought I'd at least post I've left this
piece of script in.


- Salesform in Sales.dot contains:

Sub Userform_Initialize()
**Contents**
End Sub




- I have inserted a template "call.dot" into the Word Startup folder with
the following contents:

Sub FormSizer()
ActiveDocument.AttachedTemplate = "F:\##\##\##\##\sales.dot" (network
drive
for the template for access to more users)
Application.Run "Salesform.Userform_Initialize()"
End Sub


The macro shows up in Word and I've been able to make a button for running
it as well. The

Macro isn't running though. It pops up an error box without a message.

I suspest I'm not understanding the "Application.Run
"Salesform.Userform_Initialize()" bit correctly and have done something
wrong
there, but I can't quite put my finger on it.

Doug Robbins - Word MVP said:
On my system, in the templates folder, I have a template with the name of
FormsizerDemo.dotm that contains a module with the name of ModWords and
in
that module is Sub RunWords that contains the commands to display a
userform
that is in the FormsizerDemo.dotm

Then, in a template that is saved in the Word Startup Folder, I have the
following macro:

Sub FormSizer()
ActiveDocument.AttachedTemplate =
"C:\Users\Doug\AppData\Roaming\Microsoft\Templates\FormsizerDemo.dotm"
Application.Run "ModWords.RunWords"

End Sub

Now, if I create a new blank document (from the Normal template) and then
run the macro FormSizer (which is available because the template in which
it
is located is in the Startup folder, it attaches the FormSizerDemo
template
to the blank document and displays the userform that is called by the
RunWords macro in the FormsizerDemo.dotm template.

If I was wanting to do this all of the time, I would put a button to run
the
FormSizer macro on the Ribbon (in Word 2007) or on a toolbar in earlier
versions.

In your case, the Sales.dot would take the place of FormsizerDemo.dotm in
the above example and in the template that is stored in the startup
folder,
you would have a macro that attached that template to the document that
was
active when it was run using

ActiveDocument.AttachedTemplate = "[path]\sales.dot"
Application.Run "[modulename].[macroname]"

to display the userform that is in sales.dot where the modulename is the
name of the module in sales.dot that contains the macro ([macroname])
that
causes the userform to be displayed.


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com

Hello Doug,

After some trial and error, I think I'm lost.

I'm trying to get to work the userform in an empty new document first
of
all
and then take it to step two, where you say I'm best off just making a
macro
in a template.

I have a couple of questions/problems:

- Can I place

Sub Autonew()
ActiveDocument.AttachedTemplate = "[path]\Sales.dot"
End Sub

in ThisDocument of a random new document created from normal.dot to
call
upon the template and be able to have the userform pop up?

- Do I then still need to call upon the sales.dot template in the
Add-ins
in
Word?
- Do I still have to put a Private Sub Document_New() in ThisDocument
of
the
sales.dot template? Or does this have the same function as the script
you
posted previously?
- When I activate sales.dot in the empty new document and go into the
visual
basic project the template is locked even though it's not password
protected
or write protected.
- How do you go about making a macro button in Word to call upon the
template in a new document?

Thank you in advance.

Ralf



:

If you were to put

Sub Autonew()
ActiveDocument.AttachedTemplate = "[path]\Sales.dot"
End Sub

in the normal.dot template, it would attach the Sales.dot template to
all
documents created from the Normal.dot template.

In addition, if the CRM software is any good, it may well include a
command
that prevents auto macros from running so that they do not interfere
with
what it wants to be done. Plus, screwing around with a user's
normal.dot
template is like fiddling around with their underwear.

What I would do is create a macro containing the
ActiveDocument.AttachedTemplate command in a template that was
distributed
to users and saved into their Word Startup folder and have toolbar in
that
template that contained a button to run the code. Then when the user
creates a document via the CRM, they could click on that button to
attach
the template. You could also then include in the code the commands to
call
the userform.
--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com

Hello Doug,

Thanks for this. Should it put this in my normal.dot? Because the
new
documents that are generated are all empty and therefore originating
from
my
normal.dot.

Can you give any tips as to how I would do this with multiple people
working
on the same documents? Should I replace the normal.dot on every
instance
of
MS Word in the office that needs to use the document?

Ty so much.

Greetings,

Ralf

:

If you use the following code to attach your template to the
document
that
has been created, the macros in Sales.dot will be available for use
with
that document.

ActiveDocument.AttachedTemplate = "[path]\Sales.dot"

replace [path] with the appropriate Drive:\Path

--
Hope this helps,

Doug Robbins - Word MVP

Please reply only to the newsgroups unless you wish to obtain my
services
on
a paid professional basis.

Hello Doug,

Thanks for the response. Our CRM software creates a WORD document
with
a
referencenumber that is then stored on the server so it can be
called
upon
from the CRM software. In other words, we need to work with the
document
that
the CRM software initializes. The only way that I know of to use
a
template
with it, is to insert > file the .dot template.

If I make a new document with the template, it won't have the
reference
number. And it can't be renamed because the document with that
number
already
exists. (so the CRM software would never be able to call upon the
document
because it only stores the documents with the right reference
numbers
 
D

Doug Robbins - Word MVP

Exactly what do you have where at this stage? That is what code in what
template and where is each template saved?

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com

Ralf said:
Hello Doug,

I get the feeling that I'm one step closer to getting it working.

The showform macro works correctly. The showSalesform macro in the
call.dot
doesn't work it seems. I can call the showform macro when i open the
template
sales.dot and it will show the form. In an empty new document, when only
call.dot is loaded as an add-in from the startup folder, I get an error
when
I try to run showSalesform. I've checked consistency of caps and so on, so
I
don't think that's the problem.

Thanks,

Ralf

Doug Robbins - Word MVP said:
From sales.dot, delete

Sub Document_open()
Salesform.Show
End Sub

and insert a module into it, which by default will be named Module1. In
that module, create a macro

Sub ShowForm()
Dim myForm As Salesform

Set myForm = New SalesForm
myForm.Show vbModal
Unload myForm
Set myForm = Nothing

End Sub

In Call.dot, change the macro to:

Sub SalesFormShow()
ActiveDocument.AttachedTemplate = "F:\##\##\##\##\sales.dot"
Application.Run "Module1.ShowForm"
End Sub



--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com

Ralf said:
Let me show you what I have so far:


- Sales.dot contains a form called 'Salesform' and I've inserted the
following code into ThisDocument of sales.dot:

Sub Document_open()
Salesform.Show
End Sub

This might be unnecessary, but I thought I'd at least post I've left
this
piece of script in.


- Salesform in Sales.dot contains:

Sub Userform_Initialize()
**Contents**
End Sub




- I have inserted a template "call.dot" into the Word Startup folder
with
the following contents:

Sub FormSizer()
ActiveDocument.AttachedTemplate = "F:\##\##\##\##\sales.dot" (network
drive
for the template for access to more users)
Application.Run "Salesform.Userform_Initialize()"
End Sub


The macro shows up in Word and I've been able to make a button for
running
it as well. The

Macro isn't running though. It pops up an error box without a message.

I suspest I'm not understanding the "Application.Run
"Salesform.Userform_Initialize()" bit correctly and have done something
wrong
there, but I can't quite put my finger on it.

:

On my system, in the templates folder, I have a template with the name
of
FormsizerDemo.dotm that contains a module with the name of ModWords
and
in
that module is Sub RunWords that contains the commands to display a
userform
that is in the FormsizerDemo.dotm

Then, in a template that is saved in the Word Startup Folder, I have
the
following macro:

Sub FormSizer()
ActiveDocument.AttachedTemplate =
"C:\Users\Doug\AppData\Roaming\Microsoft\Templates\FormsizerDemo.dotm"
Application.Run "ModWords.RunWords"

End Sub

Now, if I create a new blank document (from the Normal template) and
then
run the macro FormSizer (which is available because the template in
which
it
is located is in the Startup folder, it attaches the FormSizerDemo
template
to the blank document and displays the userform that is called by the
RunWords macro in the FormsizerDemo.dotm template.

If I was wanting to do this all of the time, I would put a button to
run
the
FormSizer macro on the Ribbon (in Word 2007) or on a toolbar in
earlier
versions.

In your case, the Sales.dot would take the place of FormsizerDemo.dotm
in
the above example and in the template that is stored in the startup
folder,
you would have a macro that attached that template to the document
that
was
active when it was run using

ActiveDocument.AttachedTemplate = "[path]\sales.dot"
Application.Run "[modulename].[macroname]"

to display the userform that is in sales.dot where the modulename is
the
name of the module in sales.dot that contains the macro ([macroname])
that
causes the userform to be displayed.


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com

Hello Doug,

After some trial and error, I think I'm lost.

I'm trying to get to work the userform in an empty new document
first
of
all
and then take it to step two, where you say I'm best off just making
a
macro
in a template.

I have a couple of questions/problems:

- Can I place

Sub Autonew()
ActiveDocument.AttachedTemplate = "[path]\Sales.dot"
End Sub

in ThisDocument of a random new document created from normal.dot to
call
upon the template and be able to have the userform pop up?

- Do I then still need to call upon the sales.dot template in the
Add-ins
in
Word?
- Do I still have to put a Private Sub Document_New() in
ThisDocument
of
the
sales.dot template? Or does this have the same function as the
script
you
posted previously?
- When I activate sales.dot in the empty new document and go into
the
visual
basic project the template is locked even though it's not password
protected
or write protected.
- How do you go about making a macro button in Word to call upon the
template in a new document?

Thank you in advance.

Ralf



:

If you were to put

Sub Autonew()
ActiveDocument.AttachedTemplate = "[path]\Sales.dot"
End Sub

in the normal.dot template, it would attach the Sales.dot template
to
all
documents created from the Normal.dot template.

In addition, if the CRM software is any good, it may well include a
command
that prevents auto macros from running so that they do not
interfere
with
what it wants to be done. Plus, screwing around with a user's
normal.dot
template is like fiddling around with their underwear.

What I would do is create a macro containing the
ActiveDocument.AttachedTemplate command in a template that was
distributed
to users and saved into their Word Startup folder and have toolbar
in
that
template that contained a button to run the code. Then when the
user
creates a document via the CRM, they could click on that button to
attach
the template. You could also then include in the code the commands
to
call
the userform.
--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of
my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com

Hello Doug,

Thanks for this. Should it put this in my normal.dot? Because the
new
documents that are generated are all empty and therefore
originating
from
my
normal.dot.

Can you give any tips as to how I would do this with multiple
people
working
on the same documents? Should I replace the normal.dot on every
instance
of
MS Word in the office that needs to use the document?

Ty so much.

Greetings,

Ralf

:

If you use the following code to attach your template to the
document
that
has been created, the macros in Sales.dot will be available for
use
with
that document.

ActiveDocument.AttachedTemplate = "[path]\Sales.dot"

replace [path] with the appropriate Drive:\Path

--
Hope this helps,

Doug Robbins - Word MVP

Please reply only to the newsgroups unless you wish to obtain my
services
on
a paid professional basis.

Hello Doug,

Thanks for the response. Our CRM software creates a WORD
document
with
a
referencenumber that is then stored on the server so it can be
called
upon
from the CRM software. In other words, we need to work with
the
document
that
the CRM software initializes. The only way that I know of to
use
a
template
with it, is to insert > file the .dot template.

If I make a new document with the template, it won't have the
reference
number. And it can't be renamed because the document with that
number
already
exists. (so the CRM software would never be able to call upon
the
document
because it only stores the documents with the right reference
numbers
 
R

Ralf

Hello Doug,

Below is the complete source of both documents, for the salesform, the
macro/module and the call template. In the Add-ins in Word, only call.dot is
called upon.

Template: sales.dot
Location: F:\##\##\##\##\sales.dot
Source: form "Salesform"
========================

Sub Annuleren_Click()
Unload Me
ActiveDocument.Close SaveChanges:=False
End Sub


Sub Ok_Click()
Dim strSalesmedewerker As String
Dim strAdviseurJa As String
Dim strtextAdviseurJa As String
Dim strDrijfveer As String
Dim strBijzondereWensen As String
Dim strBijzondereWens As String
Dim strBijzondereWens2 As String
Dim strTermijn As String
Dim strScope As String
Dim strKvK As String
Dim strVCA As String
Dim strtxtSystemen As String
Dim errormsgbox As String
Dim strOvername As String
Dim strOvername2 As String
Dim strOvername3 As String
Dim strOvername4 As String
Dim strBD As String
Dim strprojbezca As String
Dim strprojbezjx As String
Dim strprojbezhca As String

If NaamAdviseur <> "" Then strAdviseurJa = NaamAdviseur Else strAdviseurJa =
""
If NaamAdviseur <> "" Then strtextAdviseurJa = "Uw adviseur " & NaamAdviseur
& " heeft bij ons aangegeven dat u gecertificeerd wenst te worden voor" Else
strtextAdviseurJa = "U heeft bij ons aangegeven dat u gecertificeerd wenst te
worden voor"

If radiorvk = True Then strSalesmedewerker = "Richard van Kuringen"
If radiomw = True Then strSalesmedewerker = "Marleen Wouters"
If radiolk = True Then strSalesmedewerker = "Linda Karouw"
If radiokvz = True Then strSalesmedewerker = "Karin van Zeijl"
If radiorvt = True Then strSalesmedewerker = "Ralf van Thuijl"
If radioadw = True Then strSalesmedewerker = "Alex de Wals"

If Drijfveer = "" Then strDrijfveer = "niet bij ons bekend. Graag vernemen
wij van u wat uw drijfveer tot certificering is, zodat wij onze
dienstverlening hier verder op in kunnen richten."
If Drijfveer = "Verplichting richting klanten" Then strDrijfveer = "de
noodzaak vanwege specifieke eisen vanuit klanten en/of aanbestedingen met
betrekking tot certificatie."
If Drijfveer = "Verbetering interne organisatie" Then strDrijfveer =
"continue verbetering van uw (interne) organisatie en bevestiging daarvan
middels certificatie."
If Drijfveer = "Promotie" Then strDrijfveer = "om uw organisatie zo beter in
de markt te kunnen promoten en meerwaarde richting de markt mee te kunnen
geven."

If Insteek = "Praktijkgericht" Then strBijzondereWens = "praktijkgerichte
audits"
If Insteek = "Kritisch" Then strBijzondereWens = "kritische beoordelingen in
het certificatie-traject"
If Insteek = "Meerwaarde/Verbeterpunten" Then strBijzondereWens =
"verbeterpunten voor uw organisatie"
If Insteek = "Dezelfde auditor vaste periode" Then strBijzondereWens = "het
inzetten van dezelfde auditor(en) gedurende de gehele certificatie-periode"
If Insteek = "Onafhankelijke beoordeling" Then strBijzondereWens =
"beoordelingen door een onafhankelijke organisatie"
If Insteek = "Benadrukken onderwerpen" Then strBijzondereWens = "meer
aandacht voor specifieke onderwerpen in het kader van uw
kwaliteitsmanagementsysteem"
If Insteek = "Affiniteit branche" Then strBijzondereWens = "een
auditor/auditoren die affiniteit heeft/hebben met uw branche"
If Insteek = "De naam TUV" Then strBijzondereWens = "de naam TÃœV als merk"
If Insteek2 = "Praktijkgericht" Then strBijzondereWens2 = "praktijkgerichte
audits"
If Insteek2 = "Kritisch" Then strBijzondereWens2 = "kritische beoordelingen
in het certificatie-traject"
If Insteek2 = "Meerwaarde/Verbeterpunten" Then strBijzondereWens2 =
"verbeterpunten voor uw organisatie"
If Insteek2 = "Dezelfde auditor vaste periode" Then strBijzondereWens2 =
"het inzetten van dezelfde auditor(en) gedurende de gehele
certificatie-periode"
If Insteek2 = "Onafhankelijke beoordeling" Then strBijzondereWens2 =
"beoordelingen door een onafhankelijke organisatie"
If Insteek2 = "Benadrukken onderwerpen" Then strBijzondereWens2 = "meer
aandacht voor specifieke onderwerpen in het kader van uw
kwaliteitsmanagementsysteem"
If Insteek2 = "Affiniteit branche" Then strBijzondereWens2 = "een
auditor/auditoren die affiniteit heeft/hebben met uw branche"
If Insteek2 = "De naam TUV" Then strBijzondereWens2 = "de naam TÃœV als merk"
If Insteek = "" And Insteek2 = "" Then strBijzondereWensen = "U heeft geen
bijzondere wensen aangegeven ten behoeve van dit certificatie-traject."
If Insteek <> "" And Insteek2 <> "" Then strBijzondereWensen = "U heeft
aangegeven dat u waarde hecht aan " & strBijzondereWens & " en " &
strBijzondereWens2 & ". Met deze wensen zullen wij zoveel mogelijk rekening
houden in het certificatie-traject om u zo goed mogelijk van dienst te kunnen
zijn."
If Insteek <> "" And Insteek2 = "" Then strBijzondereWensen = "U heeft
aangegeven dat u waarde hecht aan " & strBijzondereWens & ". Met deze wens
zullen wij zoveel mogelijk rekening houden in het certificatie-traject om u
zo goed mogelijk van dienst te kunnen zijn."
If Insteek = "" And Insteek2 <> "" Then strBijzondereWensen = "U heeft
aangegeven dat u waarde hecht aan " & strBijzondereWens2 & ". Met deze wens
zullen wij zoveel mogelijk rekening houden in het certificatie-traject om u
zo goed mogelijk van dienst te kunnen zijn."

If Periode = "" And Maand = "" Then strTermijn = "U hebt geen voorkeur
aangegeven voor de periode waarin u gecertificeerd wenst te worden. Onze
afdeling Planning zal zelf met u contact opnemen om auditdata met u af te
stemmen."
If Periode = "" And Maand <> "" Then strTermijn = "U hebt als voorkeur " &
Maand & " aangegeven voor de periode waarin u gecertificeerd wenst te worden.
Met deze voorkeur houden wij rekening bij het plannen van de audits. Hoe
sneller u reageert op ons voorstel, hoe beter wij aan uw wensen voor de
invulling van onze audits kunnen voldoen."
If Periode <> "" And Maand <> "" Then strTermijn = "U hebt als voorkeur " &
Periode & " " & Maand & " aangegeven voor de periode waarin u gecertificeerd
wenst te worden. Met deze voorkeur houden wij rekening bij het plannen van de
audits. Hoe sneller u reageert op ons voorstel, hoe beter wij aan uw wensen
voor de invulling van onze audits kunnen voldoen."

If scopeja = True Then strScope = "U hebt aan ons de bedrijfsactiviteiten
zoals deze omschreven dienen te worden op het certificaat als volgt
doorgegeven:"
If scopeja = True Then strScope2 = "Mogelijk zijn bepaalde wijzigingen
aangebracht in de door u aangegeven scope vanwege regelgeving en criteria
voor certificering. De exacte inhoud van de omschrijving kunt u met uw
auditor(en) bespreken alvorens deze op het certificaat worden vermeld."
If scopenee = True Then strScope = "Hier beneden kunt u de
bedrijfsactiviteiten aangeven zoals u deze op het certificaat vermeld wilt
hebben."
If scopenee = True Then strScope2 = "Vraagt u bij ons een traject voor
certificering aan, voegt u dan deze omschrijving evenals het
aanvraagformulier bij in de antwoordenvelop."

If radiokvkja = True Then strKvK = "De registratie van uw organisatie hebben
wij geverifieerd bij de Kamer van Koophandel. Wilt u desondanks van de te
benoemen bedrijfsnaam op het certificaat afwijken, voegt u dan een uittreksel
van de KvK toe van de bedrijfsnaam die op het certificaat dient te worden
vermeld. Deze entiteit dient wel de te certificeren activiteiten uit te
voeren."
If radiokvknee = True Then strKvK = "Uw bedrijfsnaam konden wij niet
verifiëren bij de Kamer van Koophandel. Wij verzoeken u daarom op het
bijgevoegde aanvraagformulier de tenaamstelling aan te geven en een kopie van
uw registratie bij de Kamer van Koophandel (per vestiging) bij te voegen."

If VCA = "" Then strVCA = ""
If VCA <> "" Then strVCA = "Gemiddeld aantal externe werklocaties per dag in
het kader van VCA: " & VCA

If txtSystemen = "" Then errormsgbox = MsgBox("Systeem/Systemen niet
ingevuld", vbRetryCancel, "Typ systemen in")
If txtSystemen <> "" Then strtxtSystemen = txtSystemen

If overname <> "" Then strOvername = "U heeft aangegeven dat u momenteel
gecertificeerd bent voor enkele of alle systemen in dit investeringsvoorstel."
If overname <> "" Then strOvername2 = "De eerste einddatum waarvoor
verlenging wordt aangevraagd is " & overname & "."
If overname <> "" Then strOvername3 = "Wij dienen circa 3 maanden voor de
einddatum van uw certificaat/certificaten de hercertificering uit te voeren
om continuering van uw certificering te kunnen voortzetten."
If overname <> "" Then strOvername4 = "Overname certificering"
If overname = "" Then strOvername = ""

If bdja = True Then strBD = "incl.branchedeskundige"
If bdnee = True Then strBD = ""

If projbezca <> "" Then strprojbezca = "Projectbezoeken (x" & projbezca & ")"
If projbezca = "" Then strprojbezca = ""
If projbezjx <> "" Then strprojbezjx = "Projectbezoeken (x" & projbezjx & ")"
If projbezjx = "" Then strprojbezjx = ""
If projbezhca <> "" Then strprojbezhca = "Projectbezoeken (x" & projbezhca &
")"
If projbezhca = "" Then strprojbezhca = ""

With ActiveDocument
..Bookmarks("Salesmedewerker").Range.Text = strSalesmedewerker
..Bookmarks("Salesmedewerker2").Range.Text = strSalesmedewerker
..Bookmarks("Naamadviseur").Range.Text = strtextAdviseurJa
..Bookmarks("Drijfveerklant").Range.Text = strDrijfveer
..Bookmarks("BijzondereWens").Range.Text = strBijzondereWensen
..Bookmarks("Termijn").Range.Text = strTermijn
..Bookmarks("Scope").Range.Text = strScope
..Bookmarks("Scope2").Range.Text = strScope2
..Bookmarks("KvK").Range.Text = strKvK
..Bookmarks("VCA").Range.Text = strVCA
..Bookmarks("Systemen").Range.Text = strtxtSystemen
..Bookmarks("Systemen2").Range.Text = strtxtSystemen
..Bookmarks("Systemen3").Range.Text = strtxtSystemen
..Bookmarks("Systemen4").Range.Text = strtxtSystemen
..Bookmarks("Systemen5").Range.Text = strtxtSystemen
..Bookmarks("Systemen6").Range.Text = strtxtSystemen
..Bookmarks("Systemen7").Range.Text = strtxtSystemen
..Bookmarks("Systemen8").Range.Text = strtxtSystemen
..Bookmarks("Systemen9").Range.Text = strtxtSystemen
..Bookmarks("Overname").Range.Text = strOvername
..Bookmarks("Overname2").Range.Text = strOvername2
..Bookmarks("Overname3").Range.Text = strOvername3
..Bookmarks("Overname4").Range.Text = strOvername4
..Bookmarks("BD").Range.Text = strBD
..Bookmarks("BD2").Range.Text = strBD
..Bookmarks("BD3").Range.Text = strBD
..Bookmarks("projbezca").Range.Text = strprojbezca
..Bookmarks("projbezjx").Range.Text = strprojbezjx
..Bookmarks("projbezhca").Range.Text = strprojbezhca
End With

Application.ScreenUpdating = True
Unload Me
End Sub



Sub Userform_Initialize()

With Periode
..AddItem "omstreeks"
..AddItem "begin"
..AddItem "medio"
..AddItem "eind"
..AddItem "niet later dan"
..AddItem "niet eerder dan"
End With

With Maand
..AddItem "Januari"
..AddItem "Februari"
..AddItem "Maart"
..AddItem "April"
..AddItem "Mei"
..AddItem "Juni"
..AddItem "Juli"
..AddItem "Augustus"
..AddItem "September"
..AddItem "Oktober"
..AddItem "November"
..AddItem "December"
End With

With Drijfveer
..AddItem "Verplichting richting klanten"
..AddItem "Verbetering interne organisatie"
..AddItem "Promotie"
End With

With Insteek
..AddItem "Praktijkgericht"
..AddItem "Kritisch"
..AddItem "Meerwaarde/Verbeterpunten"
..AddItem "Dezelfde auditor vaste periode"
..AddItem "Onafhankelijke beoordeling"
..AddItem "Benadrukken onderwerpen"
..AddItem "Affiniteit branche"
..AddItem "De naam TUV"
End With

With Insteek2
..AddItem "Praktijkgericht"
..AddItem "Kritisch"
..AddItem "Meerwaarde/Verbeterpunten"
..AddItem "Dezelfde auditor vaste periode"
..AddItem "Onafhankelijke beoordeling"
..AddItem "Benadrukken onderwerpen"
..AddItem "Affiniteit branche"
..AddItem "De naam TUV"
End With

With VCA
..AddItem "1-5"
..AddItem "6-10"
..AddItem "11-20"
..AddItem "21-30"
..AddItem "31-50"
..AddItem "51-75"
..AddItem "76-100"
..AddItem "100+"
End With

End Sub

Sub Wissen_Click()
Maand.Value = Null
NaamAdviseur.Value = Null
Periode.Value = Null
Drijfveer.Value = Null
radiorvk.Value = Null
radiomw.Value = Null
radiolk.Value = Null
radiokvz.Value = Null
radiorvt.Value = Null
radioadw.Value = Null
Insteek2.Value = Null
Insteek.Value = Null
scopeja.Value = Null
scopenee.Value = Null
radiokvkja.Value = Null
radiokvknee.Value = Null
VCA = Null
txtSystemen = Null
overnameja = Null
overnamenee = Null
End Sub

================
Source: module "Module1" in sales.dot
================
Sub ShowForm()
Dim myForm As Salesform

Set myForm = New Salesform
myForm.Show vbModal
Unload myForm
Set myForm = Nothing

End Sub

======================
Template: call.dot
Location: Word startup folder (under documents and settings"
Source: ThisDocument
======================
Sub SalesFormShow()
ActiveDocument.AttachedTemplate = "F:\##\##\##\##\sales.dot"
Application.Run "Module1.ShowForm"
End Sub
 
D

Doug Robbins - Word MVP

I suspect that there maybe multiple Module1 on your system (probably in
Normal.dot).

Rename the Module1 in Sales.dot to ModSales

and then in Call.dot, use

Sub SalesFormShow()
ActiveDocument.AttachedTemplate = "F:\##\##\##\##\sales.dot"
Application.Run "ModSales.ShowForm"
End Sub
--
Hope this helps,

Doug Robbins - Word MVP

Please reply only to the newsgroups unless you wish to obtain my services on
a paid professional basis.
 
R

Ralf

Thank you for all the help Doug. I think it's working now, since I can open a
new document and both insert the template and use the showsalesform macro.
Unfortunately our CRM package (Navision) is blocking VBscript it seems, since
I can't get the form to load up when the new document is drafted from
Navision.

That's another problem I have to solve on my own. ;)

Thanks again.
 

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