Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.docmanagement
Bartosz Długokęcki Bartosz Długokęcki is offline
external usenet poster
 
Posts: 2
Default Word 2003 - Dynamic Templates

Hello and welcome,

In my company I have about 20 different contracts' templates. They all
have different content but the same Header and Footer with company's
logo and address.

What I would like to do is to have one file with Header and Footer
where I could change company's address, and it would update those 20
files automatic.

Do you have any ideas or solutions to this problem?

Please let me know.

Best regards,
BD.
  #2   Report Post  
Posted to microsoft.public.word.docmanagement
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default Word 2003 - Dynamic Templates

With existing templates you have two choices. Either use a batch replace
process to replace the changed text in the templates -
http://www.gmayor.com/batch_replace.htm should get you started though you
will need to change the line myFile = Dir$(PathToUse & "*.doc") to myFile =
Dir$(PathToUse & "*.dot") - or replace the header footer information with
linked bookmarked sections from another document (which will only really be
of benefit of you plan on moving often).

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org




"Bartosz Dlugokecki" wrote in message
...
Hello and welcome,

In my company I have about 20 different contracts' templates. They all
have different content but the same Header and Footer with company's
logo and address.

What I would like to do is to have one file with Header and Footer
where I could change company's address, and it would update those 20
files automatic.

Do you have any ideas or solutions to this problem?

Please let me know.

Best regards,
BD.



  #3   Report Post  
Posted to microsoft.public.word.docmanagement
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default Word 2003 - Dynamic Templates

With existing templates you have two choices. Either use a batch replace
process to replace the changed text in the templates -
http://www.gmayor.com/batch_replace.htm should get you started though you
will need to change the line myFile = Dir$(PathToUse & "*.doc") to myFile =
Dir$(PathToUse & "*.dot") - or replace the header footer information with
linked bookmarked sections from another document (which will only really be
of benefit of you plan on moving often).

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org




"Bartosz Dlugokecki" wrote in message
...
Hello and welcome,

In my company I have about 20 different contracts' templates. They all
have different content but the same Header and Footer with company's
logo and address.

What I would like to do is to have one file with Header and Footer
where I could change company's address, and it would update those 20
files automatic.

Do you have any ideas or solutions to this problem?

Please let me know.

Best regards,
BD.



  #4   Report Post  
Posted to microsoft.public.word.docmanagement
BD BD is offline
external usenet poster
 
Posts: 8
Default Word 2003 - Dynamic Templates

Thank you for suggestion.

In order to your first suggestion I should be able to change this
macro to work properly, but I don't fully understand your second one.
Replace it with bookmarked section? What do you mean exactly? How can
I do this?

How about new templates? I will have to create 15 new contracts and
again with different content and the same Header and Footer. Is there
a way to create new files with capability to changing Headers and
Footers automatic in all those new files?

Best regards,
BD.

On 12 Mar, 10:03, "Graham Mayor" wrote:
With existing templates you have two choices. Either use a batch replace
process to replace the changed text in the templates -http://www.gmayor.com/batch_replace.htmshould get you started though you
will need to change the line myFile = Dir$(PathToUse & "*.doc") to myFile =
Dir$(PathToUse & "*.dot") - or replace the header footer information with
linked bookmarked sections from another document (which will only really be
of benefit of you plan on moving often).

--

Graham Mayor - *Word MVP

My web sitewww.gmayor.com
Word MVP web sitehttp://word.mvps.org


"Bartosz Dlugokecki" wrote in message

...

Hello and welcome,


In my company I have about 20 different contracts' templates. They all
have different content but the same Header and Footer with company's
logo and address.


What I would like to do is to have one file with Header and Footer
where I could change company's address, and it would update those 20
files automatic.


Do you have any ideas or solutions to this problem?


Please let me know.


Best regards,
BD.


  #5   Report Post  
Posted to microsoft.public.word.docmanagement
BD BD is offline
external usenet poster
 
Posts: 8
Default Word 2003 - Dynamic Templates

Thank you for suggestion.

In order to your first suggestion I should be able to change this
macro to work properly, but I don't fully understand your second one.
Replace it with bookmarked section? What do you mean exactly? How can
I do this?

How about new templates? I will have to create 15 new contracts and
again with different content and the same Header and Footer. Is there
a way to create new files with capability to changing Headers and
Footers automatic in all those new files?

Best regards,
BD.

On 12 Mar, 10:03, "Graham Mayor" wrote:
With existing templates you have two choices. Either use a batch replace
process to replace the changed text in the templates -http://www.gmayor.com/batch_replace.htmshould get you started though you
will need to change the line myFile = Dir$(PathToUse & "*.doc") to myFile =
Dir$(PathToUse & "*.dot") - or replace the header footer information with
linked bookmarked sections from another document (which will only really be
of benefit of you plan on moving often).

--

Graham Mayor - *Word MVP

My web sitewww.gmayor.com
Word MVP web sitehttp://word.mvps.org


"Bartosz Dlugokecki" wrote in message

...

Hello and welcome,


In my company I have about 20 different contracts' templates. They all
have different content but the same Header and Footer with company's
logo and address.


What I would like to do is to have one file with Header and Footer
where I could change company's address, and it would update those 20
files automatic.


Do you have any ideas or solutions to this problem?


Please let me know.


Best regards,
BD.




  #6   Report Post  
Posted to microsoft.public.word.docmanagement
BD BD is offline
external usenet poster
 
Posts: 8
Default Word 2003 - Dynamic Templates

Oh.. And there is one more think.

I would like to be able to change/replace whole Header and/or Footer:
text, formating, images, autotexts(page number, number of sites).

So.. In the end I would like to have:
- 1 Template File with Header and Footer
- XX number of Contract Files which are using Header and Footer from
Template File, and will automatically change when I edit Template
File.

Is there a way to do this?

BD.

On 12 Mar, 10:26, BD wrote:
Thank you for suggestion.

In order to your first suggestion I should be able to change this
macro to work properly, but I don't fully understand your second one.
Replace it with bookmarked section? What do you mean exactly? How can
I do this?

How about new templates? I will have to create 15 new contracts and
again with different content and the same Header and Footer. Is there
a way to create new files with capability to changing Headers and
Footers automatic in all those new files?

Best regards,
BD.

On 12 Mar, 10:03, "Graham Mayor" wrote:

With existing templates you have two choices. Either use a batch replace
process to replace the changed text in the templates -http://www.gmayor..com/batch_replace.htmshouldget you started though you
will need to change the line myFile = Dir$(PathToUse & "*.doc") to myFile =
Dir$(PathToUse & "*.dot") - or replace the header footer information with
linked bookmarked sections from another document (which will only really be
of benefit of you plan on moving often).


--

Graham Mayor - *Word MVP


My web sitewww.gmayor.com
Word MVP web sitehttp://word.mvps.org


"Bartosz Dlugokecki" wrote in message


...


Hello and welcome,


In my company I have about 20 different contracts' templates. They all
have different content but the same Header and Footer with company's
logo and address.


What I would like to do is to have one file with Header and Footer
where I could change company's address, and it would update those 20
files automatic.


Do you have any ideas or solutions to this problem?


Please let me know.


Best regards,
BD.


  #7   Report Post  
Posted to microsoft.public.word.docmanagement
BD BD is offline
external usenet poster
 
Posts: 8
Default Word 2003 - Dynamic Templates

Oh.. And there is one more think.

I would like to be able to change/replace whole Header and/or Footer:
text, formating, images, autotexts(page number, number of sites).

So.. In the end I would like to have:
- 1 Template File with Header and Footer
- XX number of Contract Files which are using Header and Footer from
Template File, and will automatically change when I edit Template
File.

Is there a way to do this?

BD.

On 12 Mar, 10:26, BD wrote:
Thank you for suggestion.

In order to your first suggestion I should be able to change this
macro to work properly, but I don't fully understand your second one.
Replace it with bookmarked section? What do you mean exactly? How can
I do this?

How about new templates? I will have to create 15 new contracts and
again with different content and the same Header and Footer. Is there
a way to create new files with capability to changing Headers and
Footers automatic in all those new files?

Best regards,
BD.

On 12 Mar, 10:03, "Graham Mayor" wrote:

With existing templates you have two choices. Either use a batch replace
process to replace the changed text in the templates -http://www.gmayor..com/batch_replace.htmshouldget you started though you
will need to change the line myFile = Dir$(PathToUse & "*.doc") to myFile =
Dir$(PathToUse & "*.dot") - or replace the header footer information with
linked bookmarked sections from another document (which will only really be
of benefit of you plan on moving often).


--

Graham Mayor - *Word MVP


My web sitewww.gmayor.com
Word MVP web sitehttp://word.mvps.org


"Bartosz Dlugokecki" wrote in message


...


Hello and welcome,


In my company I have about 20 different contracts' templates. They all
have different content but the same Header and Footer with company's
logo and address.


What I would like to do is to have one file with Header and Footer
where I could change company's address, and it would update those 20
files automatic.


Do you have any ideas or solutions to this problem?


Please let me know.


Best regards,
BD.


  #8   Report Post  
Posted to microsoft.public.word.docmanagement
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default Word 2003 - Dynamic Templates

To implement the second option you would have to recreate all your templates
using includetext and/or includepicture fields in place of the address and
logo . It is not worth the hassle unless you change address often. If the
templates all use the same header information, it is probably still simpler
to batch replace the old header address with the new one.It would be easy
enough to modify the macro to target the information specifically.

If starting again from scratch, then I would also consider using docvariable
fields to display the address information, but again you would need to use a
macro to batch update the templates to change the content of the
docvariables. eg the following macro will update the docvariable fields
{DocVariable varAddress} and {DocVariable varPhone} with the new information
gathered from the macro. Actually it wouldn't be that much more difficult to
replace the address with the docvariable fields by macro also.

Sub BatchProcess()
Dim strFilename As String
Dim strPath As String
Dim oDoc As Document
Dim fDialog As FileDialog
Dim sAddr1 As String
Dim sAddr2 As String
Dim sAddr3 As String
Dim sAddr4 As String
Dim sPhone As String

sAddr1 = InputBox("Address Line 1?")
sAddr2 = InputBox("Address Line 2?")
sAddr3 = InputBox("Address Line 3?")
sAddr4 = InputBox("Address Line 4?")
sPhone = InputBox("Phone Number?")

Set fDialog = Application.FileDialog(msoFileDialogFolderPicker)

With fDialog
.Title = "Select folder and click OK"
.AllowMultiSelect = False
.InitialView = msoFileDialogViewList
If .Show -1 Then
MsgBox "Cancelled By User", , _
"List Folder Contents"
Exit Sub
End If
strPath = fDialog.SelectedItems.Item(1)
If Right(strPath, 1) "\" _
Then strPath = strPath + "\"
End With

If Documents.Count 0 Then
Documents.Close SaveChanges:=wdPromptToSaveChanges
End If
If Left(strPath, 1) = Chr(34) Then
strPath = Mid(strPath, 2, Len(strPath) - 2)
End If
strFilename = Dir$(strPath & "*.dot")

While Len(strFilename) 0
Set oDoc = Documents.Open(strPath & strFilename)
'
'Do what you want with oDoc e.g.
oDoc.Variables("varAddress").Value = sAddr1 & Chr(13) & _
sAddr2 & Chr(13) & sAddr3 & Chr(13) & sAddr4
oDoc.Variables("varPhone").Value = sPhone
oDoc.Fields.Update
'
oDoc.Close SaveChanges:=wdSaveChanges
strFilename = Dir$()
Wend
End Sub

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



"BD" wrote in message
...
Thank you for suggestion.

In order to your first suggestion I should be able to change this
macro to work properly, but I don't fully understand your second one.
Replace it with bookmarked section? What do you mean exactly? How can
I do this?

How about new templates? I will have to create 15 new contracts and
again with different content and the same Header and Footer. Is there
a way to create new files with capability to changing Headers and
Footers automatic in all those new files?

Best regards,
BD.

On 12 Mar, 10:03, "Graham Mayor" wrote:
With existing templates you have two choices. Either use a batch replace
process to replace the changed text in the
templates -http://www.gmayor.com/batch_replace.htmshould get you started
though you
will need to change the line myFile = Dir$(PathToUse & "*.doc") to myFile
=
Dir$(PathToUse & "*.dot") - or replace the header footer information with
linked bookmarked sections from another document (which will only really
be
of benefit of you plan on moving often).

--

Graham Mayor - Word MVP

My web sitewww.gmayor.com
Word MVP web sitehttp://word.mvps.org


"Bartosz Dlugokecki" wrote in message

...

Hello and welcome,


In my company I have about 20 different contracts' templates. They all
have different content but the same Header and Footer with company's
logo and address.


What I would like to do is to have one file with Header and Footer
where I could change company's address, and it would update those 20
files automatic.


Do you have any ideas or solutions to this problem?


Please let me know.


Best regards,
BD.



  #9   Report Post  
Posted to microsoft.public.word.docmanagement
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default Word 2003 - Dynamic Templates

To implement the second option you would have to recreate all your templates
using includetext and/or includepicture fields in place of the address and
logo . It is not worth the hassle unless you change address often. If the
templates all use the same header information, it is probably still simpler
to batch replace the old header address with the new one.It would be easy
enough to modify the macro to target the information specifically.

If starting again from scratch, then I would also consider using docvariable
fields to display the address information, but again you would need to use a
macro to batch update the templates to change the content of the
docvariables. eg the following macro will update the docvariable fields
{DocVariable varAddress} and {DocVariable varPhone} with the new information
gathered from the macro. Actually it wouldn't be that much more difficult to
replace the address with the docvariable fields by macro also.

Sub BatchProcess()
Dim strFilename As String
Dim strPath As String
Dim oDoc As Document
Dim fDialog As FileDialog
Dim sAddr1 As String
Dim sAddr2 As String
Dim sAddr3 As String
Dim sAddr4 As String
Dim sPhone As String

sAddr1 = InputBox("Address Line 1?")
sAddr2 = InputBox("Address Line 2?")
sAddr3 = InputBox("Address Line 3?")
sAddr4 = InputBox("Address Line 4?")
sPhone = InputBox("Phone Number?")

Set fDialog = Application.FileDialog(msoFileDialogFolderPicker)

With fDialog
.Title = "Select folder and click OK"
.AllowMultiSelect = False
.InitialView = msoFileDialogViewList
If .Show -1 Then
MsgBox "Cancelled By User", , _
"List Folder Contents"
Exit Sub
End If
strPath = fDialog.SelectedItems.Item(1)
If Right(strPath, 1) "\" _
Then strPath = strPath + "\"
End With

If Documents.Count 0 Then
Documents.Close SaveChanges:=wdPromptToSaveChanges
End If
If Left(strPath, 1) = Chr(34) Then
strPath = Mid(strPath, 2, Len(strPath) - 2)
End If
strFilename = Dir$(strPath & "*.dot")

While Len(strFilename) 0
Set oDoc = Documents.Open(strPath & strFilename)
'
'Do what you want with oDoc e.g.
oDoc.Variables("varAddress").Value = sAddr1 & Chr(13) & _
sAddr2 & Chr(13) & sAddr3 & Chr(13) & sAddr4
oDoc.Variables("varPhone").Value = sPhone
oDoc.Fields.Update
'
oDoc.Close SaveChanges:=wdSaveChanges
strFilename = Dir$()
Wend
End Sub

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



"BD" wrote in message
...
Thank you for suggestion.

In order to your first suggestion I should be able to change this
macro to work properly, but I don't fully understand your second one.
Replace it with bookmarked section? What do you mean exactly? How can
I do this?

How about new templates? I will have to create 15 new contracts and
again with different content and the same Header and Footer. Is there
a way to create new files with capability to changing Headers and
Footers automatic in all those new files?

Best regards,
BD.

On 12 Mar, 10:03, "Graham Mayor" wrote:
With existing templates you have two choices. Either use a batch replace
process to replace the changed text in the
templates -http://www.gmayor.com/batch_replace.htmshould get you started
though you
will need to change the line myFile = Dir$(PathToUse & "*.doc") to myFile
=
Dir$(PathToUse & "*.dot") - or replace the header footer information with
linked bookmarked sections from another document (which will only really
be
of benefit of you plan on moving often).

--

Graham Mayor - Word MVP

My web sitewww.gmayor.com
Word MVP web sitehttp://word.mvps.org


"Bartosz Dlugokecki" wrote in message

...

Hello and welcome,


In my company I have about 20 different contracts' templates. They all
have different content but the same Header and Footer with company's
logo and address.


What I would like to do is to have one file with Header and Footer
where I could change company's address, and it would update those 20
files automatic.


Do you have any ideas or solutions to this problem?


Please let me know.


Best regards,
BD.



  #10   Report Post  
Posted to microsoft.public.word.docmanagement
BD BD is offline
external usenet poster
 
Posts: 8
Default Word 2003 - Dynamic Templates

Thank you for your suggestions.

I'm wondering if it's possible to to use 'header.htm' which is visible
in Microsoft Script Editor and create a macro which will replace
'header.htm' file in this every Contracts Files with 'Template
Header'?

What do you think?


BD



On 12 Mar, 10:59, "Graham Mayor" wrote:
To implement the second option you would have to recreate all your templates
using includetext and/or includepicture fields in place of the address and
logo . It is not worth the hassle unless you change address often. If the
templates all use the same header information, it is probably still simpler
to batch replace the old header address with the new one.It would be easy
enough to modify the macro to target the information specifically.

If starting again from scratch, then I would also consider using docvariable
fields to display the address information, but again you would need to use a
macro to batch update the templates to change the content of the
docvariables. eg the following macro will update the docvariable fields
{DocVariable varAddress} and {DocVariable varPhone} with the new information
gathered from the macro. Actually it wouldn't be that much more difficult to
replace the address with the docvariable fields by macro also.

Sub BatchProcess()
Dim strFilename As String
Dim strPath As String
Dim oDoc As Document
Dim fDialog As FileDialog
Dim sAddr1 As String
Dim sAddr2 As String
Dim sAddr3 As String
Dim sAddr4 As String
Dim sPhone As String

sAddr1 = InputBox("Address Line 1?")
sAddr2 = InputBox("Address Line 2?")
sAddr3 = InputBox("Address Line 3?")
sAddr4 = InputBox("Address Line 4?")
sPhone = InputBox("Phone Number?")

Set fDialog = Application.FileDialog(msoFileDialogFolderPicker)

With fDialog
* * .Title = "Select folder and click OK"
* * .AllowMultiSelect = False
* * .InitialView = msoFileDialogViewList
* * If .Show -1 Then
* * * * MsgBox "Cancelled By User", , _
* * * * "List Folder Contents"
* * * * Exit Sub
* * End If
* * strPath = fDialog.SelectedItems.Item(1)
* * If Right(strPath, 1) "\" _
* * Then strPath = strPath + "\"
End With

If Documents.Count 0 Then
* * Documents.Close SaveChanges:=wdPromptToSaveChanges
End If
If Left(strPath, 1) = Chr(34) Then
* * strPath = Mid(strPath, 2, Len(strPath) - 2)
End If
strFilename = Dir$(strPath & "*.dot")

While Len(strFilename) 0
* * Set oDoc = Documents.Open(strPath & strFilename)
* * '
* * 'Do what you want with oDoc e.g.
* * oDoc.Variables("varAddress").Value = sAddr1 & Chr(13) & _
* * sAddr2 & Chr(13) & sAddr3 & Chr(13) & sAddr4
* * oDoc.Variables("varPhone").Value = sPhone
* * oDoc.Fields.Update
* * '
* * oDoc.Close SaveChanges:=wdSaveChanges
* * strFilename = Dir$()
Wend
End Sub

--

Graham Mayor - *Word MVP

My web sitewww.gmayor.com
Word MVP web sitehttp://word.mvps.org


"BD" wrote in message

...
Thank you for suggestion.

In order to your first suggestion I should be able to change this
macro to work properly, but I don't fully understand your second one.
Replace it with bookmarked section? What do you mean exactly? How can
I do this?

How about new templates? I will have to create 15 new contracts and
again with different content and the same Header and Footer. Is there
a way to create new files with capability to changing Headers and
Footers automatic in all those new files?

Best regards,
BD.

On 12 Mar, 10:03, "Graham Mayor" wrote:

With existing templates you have two choices. Either use a batch replace
process to replace the changed text in the
templates -http://www.gmayor.com/batch_replace.htmshouldget you started
though you
will need to change the line myFile = Dir$(PathToUse & "*.doc") to myFile
=
Dir$(PathToUse & "*.dot") - or replace the header footer information with
linked bookmarked sections from another document (which will only really
be
of benefit of you plan on moving often).


--

Graham Mayor - Word MVP


My web sitewww.gmayor.com
Word MVP web sitehttp://word.mvps.org


"Bartosz Dlugokecki" wrote in message


...


Hello and welcome,


In my company I have about 20 different contracts' templates. They all
have different content but the same Header and Footer with company's
logo and address.


What I would like to do is to have one file with Header and Footer
where I could change company's address, and it would update those 20
files automatic.


Do you have any ideas or solutions to this problem?


Please let me know.


Best regards,
BD.




  #11   Report Post  
Posted to microsoft.public.word.docmanagement
BD BD is offline
external usenet poster
 
Posts: 8
Default Word 2003 - Dynamic Templates

Thank you for your suggestions.

I'm wondering if it's possible to to use 'header.htm' which is visible
in Microsoft Script Editor and create a macro which will replace
'header.htm' file in this every Contracts Files with 'Template
Header'?

What do you think?


BD



On 12 Mar, 10:59, "Graham Mayor" wrote:
To implement the second option you would have to recreate all your templates
using includetext and/or includepicture fields in place of the address and
logo . It is not worth the hassle unless you change address often. If the
templates all use the same header information, it is probably still simpler
to batch replace the old header address with the new one.It would be easy
enough to modify the macro to target the information specifically.

If starting again from scratch, then I would also consider using docvariable
fields to display the address information, but again you would need to use a
macro to batch update the templates to change the content of the
docvariables. eg the following macro will update the docvariable fields
{DocVariable varAddress} and {DocVariable varPhone} with the new information
gathered from the macro. Actually it wouldn't be that much more difficult to
replace the address with the docvariable fields by macro also.

Sub BatchProcess()
Dim strFilename As String
Dim strPath As String
Dim oDoc As Document
Dim fDialog As FileDialog
Dim sAddr1 As String
Dim sAddr2 As String
Dim sAddr3 As String
Dim sAddr4 As String
Dim sPhone As String

sAddr1 = InputBox("Address Line 1?")
sAddr2 = InputBox("Address Line 2?")
sAddr3 = InputBox("Address Line 3?")
sAddr4 = InputBox("Address Line 4?")
sPhone = InputBox("Phone Number?")

Set fDialog = Application.FileDialog(msoFileDialogFolderPicker)

With fDialog
* * .Title = "Select folder and click OK"
* * .AllowMultiSelect = False
* * .InitialView = msoFileDialogViewList
* * If .Show -1 Then
* * * * MsgBox "Cancelled By User", , _
* * * * "List Folder Contents"
* * * * Exit Sub
* * End If
* * strPath = fDialog.SelectedItems.Item(1)
* * If Right(strPath, 1) "\" _
* * Then strPath = strPath + "\"
End With

If Documents.Count 0 Then
* * Documents.Close SaveChanges:=wdPromptToSaveChanges
End If
If Left(strPath, 1) = Chr(34) Then
* * strPath = Mid(strPath, 2, Len(strPath) - 2)
End If
strFilename = Dir$(strPath & "*.dot")

While Len(strFilename) 0
* * Set oDoc = Documents.Open(strPath & strFilename)
* * '
* * 'Do what you want with oDoc e.g.
* * oDoc.Variables("varAddress").Value = sAddr1 & Chr(13) & _
* * sAddr2 & Chr(13) & sAddr3 & Chr(13) & sAddr4
* * oDoc.Variables("varPhone").Value = sPhone
* * oDoc.Fields.Update
* * '
* * oDoc.Close SaveChanges:=wdSaveChanges
* * strFilename = Dir$()
Wend
End Sub

--

Graham Mayor - *Word MVP

My web sitewww.gmayor.com
Word MVP web sitehttp://word.mvps.org


"BD" wrote in message

...
Thank you for suggestion.

In order to your first suggestion I should be able to change this
macro to work properly, but I don't fully understand your second one.
Replace it with bookmarked section? What do you mean exactly? How can
I do this?

How about new templates? I will have to create 15 new contracts and
again with different content and the same Header and Footer. Is there
a way to create new files with capability to changing Headers and
Footers automatic in all those new files?

Best regards,
BD.

On 12 Mar, 10:03, "Graham Mayor" wrote:

With existing templates you have two choices. Either use a batch replace
process to replace the changed text in the
templates -http://www.gmayor.com/batch_replace.htmshouldget you started
though you
will need to change the line myFile = Dir$(PathToUse & "*.doc") to myFile
=
Dir$(PathToUse & "*.dot") - or replace the header footer information with
linked bookmarked sections from another document (which will only really
be
of benefit of you plan on moving often).


--

Graham Mayor - Word MVP


My web sitewww.gmayor.com
Word MVP web sitehttp://word.mvps.org


"Bartosz Dlugokecki" wrote in message


...


Hello and welcome,


In my company I have about 20 different contracts' templates. They all
have different content but the same Header and Footer with company's
logo and address.


What I would like to do is to have one file with Header and Footer
where I could change company's address, and it would update those 20
files automatic.


Do you have any ideas or solutions to this problem?


Please let me know.


Best regards,
BD.


  #12   Report Post  
Posted to microsoft.public.word.docmanagement
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default Word 2003 - Dynamic Templates

You cannot open a template in the script editor.
Why work in the script editor when you can work in the template?

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



"BD" wrote in message
...
Thank you for your suggestions.

I'm wondering if it's possible to to use 'header.htm' which is visible
in Microsoft Script Editor and create a macro which will replace
'header.htm' file in this every Contracts Files with 'Template
Header'?

What do you think?


BD



On 12 Mar, 10:59, "Graham Mayor" wrote:
To implement the second option you would have to recreate all your
templates
using includetext and/or includepicture fields in place of the address and
logo . It is not worth the hassle unless you change address often. If the
templates all use the same header information, it is probably still
simpler
to batch replace the old header address with the new one.It would be easy
enough to modify the macro to target the information specifically.

If starting again from scratch, then I would also consider using
docvariable
fields to display the address information, but again you would need to use
a
macro to batch update the templates to change the content of the
docvariables. eg the following macro will update the docvariable fields
{DocVariable varAddress} and {DocVariable varPhone} with the new
information
gathered from the macro. Actually it wouldn't be that much more difficult
to
replace the address with the docvariable fields by macro also.

Sub BatchProcess()
Dim strFilename As String
Dim strPath As String
Dim oDoc As Document
Dim fDialog As FileDialog
Dim sAddr1 As String
Dim sAddr2 As String
Dim sAddr3 As String
Dim sAddr4 As String
Dim sPhone As String

sAddr1 = InputBox("Address Line 1?")
sAddr2 = InputBox("Address Line 2?")
sAddr3 = InputBox("Address Line 3?")
sAddr4 = InputBox("Address Line 4?")
sPhone = InputBox("Phone Number?")

Set fDialog = Application.FileDialog(msoFileDialogFolderPicker)

With fDialog
.Title = "Select folder and click OK"
.AllowMultiSelect = False
.InitialView = msoFileDialogViewList
If .Show -1 Then
MsgBox "Cancelled By User", , _
"List Folder Contents"
Exit Sub
End If
strPath = fDialog.SelectedItems.Item(1)
If Right(strPath, 1) "\" _
Then strPath = strPath + "\"
End With

If Documents.Count 0 Then
Documents.Close SaveChanges:=wdPromptToSaveChanges
End If
If Left(strPath, 1) = Chr(34) Then
strPath = Mid(strPath, 2, Len(strPath) - 2)
End If
strFilename = Dir$(strPath & "*.dot")

While Len(strFilename) 0
Set oDoc = Documents.Open(strPath & strFilename)
'
'Do what you want with oDoc e.g.
oDoc.Variables("varAddress").Value = sAddr1 & Chr(13) & _
sAddr2 & Chr(13) & sAddr3 & Chr(13) & sAddr4
oDoc.Variables("varPhone").Value = sPhone
oDoc.Fields.Update
'
oDoc.Close SaveChanges:=wdSaveChanges
strFilename = Dir$()
Wend
End Sub

--

Graham Mayor - Word MVP

My web sitewww.gmayor.com
Word MVP web sitehttp://word.mvps.org


"BD" wrote in message

...
Thank you for suggestion.

In order to your first suggestion I should be able to change this
macro to work properly, but I don't fully understand your second one.
Replace it with bookmarked section? What do you mean exactly? How can
I do this?

How about new templates? I will have to create 15 new contracts and
again with different content and the same Header and Footer. Is there
a way to create new files with capability to changing Headers and
Footers automatic in all those new files?

Best regards,
BD.

On 12 Mar, 10:03, "Graham Mayor" wrote:

With existing templates you have two choices. Either use a batch replace
process to replace the changed text in the
templates -http://www.gmayor.com/batch_replace.htmshouldget you started
though you
will need to change the line myFile = Dir$(PathToUse & "*.doc") to
myFile
=
Dir$(PathToUse & "*.dot") - or replace the header footer information
with
linked bookmarked sections from another document (which will only really
be
of benefit of you plan on moving often).


--

Graham Mayor - Word MVP


My web sitewww.gmayor.com
Word MVP web sitehttp://word.mvps.org


"Bartosz Dlugokecki" wrote in message


...


Hello and welcome,


In my company I have about 20 different contracts' templates. They all
have different content but the same Header and Footer with company's
logo and address.


What I would like to do is to have one file with Header and Footer
where I could change company's address, and it would update those 20
files automatic.


Do you have any ideas or solutions to this problem?


Please let me know.


Best regards,
BD.



  #13   Report Post  
Posted to microsoft.public.word.docmanagement
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default Word 2003 - Dynamic Templates

You cannot open a template in the script editor.
Why work in the script editor when you can work in the template?

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



"BD" wrote in message
...
Thank you for your suggestions.

I'm wondering if it's possible to to use 'header.htm' which is visible
in Microsoft Script Editor and create a macro which will replace
'header.htm' file in this every Contracts Files with 'Template
Header'?

What do you think?


BD



On 12 Mar, 10:59, "Graham Mayor" wrote:
To implement the second option you would have to recreate all your
templates
using includetext and/or includepicture fields in place of the address and
logo . It is not worth the hassle unless you change address often. If the
templates all use the same header information, it is probably still
simpler
to batch replace the old header address with the new one.It would be easy
enough to modify the macro to target the information specifically.

If starting again from scratch, then I would also consider using
docvariable
fields to display the address information, but again you would need to use
a
macro to batch update the templates to change the content of the
docvariables. eg the following macro will update the docvariable fields
{DocVariable varAddress} and {DocVariable varPhone} with the new
information
gathered from the macro. Actually it wouldn't be that much more difficult
to
replace the address with the docvariable fields by macro also.

Sub BatchProcess()
Dim strFilename As String
Dim strPath As String
Dim oDoc As Document
Dim fDialog As FileDialog
Dim sAddr1 As String
Dim sAddr2 As String
Dim sAddr3 As String
Dim sAddr4 As String
Dim sPhone As String

sAddr1 = InputBox("Address Line 1?")
sAddr2 = InputBox("Address Line 2?")
sAddr3 = InputBox("Address Line 3?")
sAddr4 = InputBox("Address Line 4?")
sPhone = InputBox("Phone Number?")

Set fDialog = Application.FileDialog(msoFileDialogFolderPicker)

With fDialog
.Title = "Select folder and click OK"
.AllowMultiSelect = False
.InitialView = msoFileDialogViewList
If .Show -1 Then
MsgBox "Cancelled By User", , _
"List Folder Contents"
Exit Sub
End If
strPath = fDialog.SelectedItems.Item(1)
If Right(strPath, 1) "\" _
Then strPath = strPath + "\"
End With

If Documents.Count 0 Then
Documents.Close SaveChanges:=wdPromptToSaveChanges
End If
If Left(strPath, 1) = Chr(34) Then
strPath = Mid(strPath, 2, Len(strPath) - 2)
End If
strFilename = Dir$(strPath & "*.dot")

While Len(strFilename) 0
Set oDoc = Documents.Open(strPath & strFilename)
'
'Do what you want with oDoc e.g.
oDoc.Variables("varAddress").Value = sAddr1 & Chr(13) & _
sAddr2 & Chr(13) & sAddr3 & Chr(13) & sAddr4
oDoc.Variables("varPhone").Value = sPhone
oDoc.Fields.Update
'
oDoc.Close SaveChanges:=wdSaveChanges
strFilename = Dir$()
Wend
End Sub

--

Graham Mayor - Word MVP

My web sitewww.gmayor.com
Word MVP web sitehttp://word.mvps.org


"BD" wrote in message

...
Thank you for suggestion.

In order to your first suggestion I should be able to change this
macro to work properly, but I don't fully understand your second one.
Replace it with bookmarked section? What do you mean exactly? How can
I do this?

How about new templates? I will have to create 15 new contracts and
again with different content and the same Header and Footer. Is there
a way to create new files with capability to changing Headers and
Footers automatic in all those new files?

Best regards,
BD.

On 12 Mar, 10:03, "Graham Mayor" wrote:

With existing templates you have two choices. Either use a batch replace
process to replace the changed text in the
templates -http://www.gmayor.com/batch_replace.htmshouldget you started
though you
will need to change the line myFile = Dir$(PathToUse & "*.doc") to
myFile
=
Dir$(PathToUse & "*.dot") - or replace the header footer information
with
linked bookmarked sections from another document (which will only really
be
of benefit of you plan on moving often).


--

Graham Mayor - Word MVP


My web sitewww.gmayor.com
Word MVP web sitehttp://word.mvps.org


"Bartosz Dlugokecki" wrote in message


...


Hello and welcome,


In my company I have about 20 different contracts' templates. They all
have different content but the same Header and Footer with company's
logo and address.


What I would like to do is to have one file with Header and Footer
where I could change company's address, and it would update those 20
files automatic.


Do you have any ideas or solutions to this problem?


Please let me know.


Best regards,
BD.



  #14   Report Post  
Posted to microsoft.public.word.docmanagement
BD BD is offline
external usenet poster
 
Posts: 8
Default Word 2003 - Dynamic Templates

To be honest I don't know what script editor is for, I've just seen
that header.htm file and asked. =)

What if I would not use templates and instead of them I use normal
document. Would it make this whole operation easier? The clue is that
this Header and Footer is changing approximately 1-2 times a month,
because it contains other data then address. Therefore I need to be
able to easily edit this Header. Macro doesn't seems to solve
formatting problem and imputing images, etc.

Best regards,
BD.

On 12 Mar, 12:29, "Graham Mayor" wrote:
You cannot open a template in the script editor.
Why work in the script editor when you can work in the template?

--

Graham Mayor - *Word MVP

My web sitewww.gmayor.com
Word MVP web sitehttp://word.mvps.org


"BD" wrote in message

...
Thank you for your suggestions.

I'm wondering if it's possible to to use 'header.htm' which is visible
in Microsoft Script Editor and create a macro which will replace
'header.htm' file in this every Contracts Files with 'Template
Header'?

What do you think?

BD

On 12 Mar, 10:59, "Graham Mayor" wrote:

To implement the second option you would have to recreate all your
templates
using includetext and/or includepicture fields in place of the address and
logo . It is not worth the hassle unless you change address often. If the
templates all use the same header information, it is probably still
simpler
to batch replace the old header address with the new one.It would be easy
enough to modify the macro to target the information specifically.


If starting again from scratch, then I would also consider using
docvariable
fields to display the address information, but again you would need to use
a
macro to batch update the templates to change the content of the
docvariables. eg the following macro will update the docvariable fields
{DocVariable varAddress} and {DocVariable varPhone} with the new
information
gathered from the macro. Actually it wouldn't be that much more difficult
to
replace the address with the docvariable fields by macro also.


Sub BatchProcess()
Dim strFilename As String
Dim strPath As String
Dim oDoc As Document
Dim fDialog As FileDialog
Dim sAddr1 As String
Dim sAddr2 As String
Dim sAddr3 As String
Dim sAddr4 As String
Dim sPhone As String


sAddr1 = InputBox("Address Line 1?")
sAddr2 = InputBox("Address Line 2?")
sAddr3 = InputBox("Address Line 3?")
sAddr4 = InputBox("Address Line 4?")
sPhone = InputBox("Phone Number?")


Set fDialog = Application.FileDialog(msoFileDialogFolderPicker)


With fDialog
.Title = "Select folder and click OK"
.AllowMultiSelect = False
.InitialView = msoFileDialogViewList
If .Show -1 Then
MsgBox "Cancelled By User", , _
"List Folder Contents"
Exit Sub
End If
strPath = fDialog.SelectedItems.Item(1)
If Right(strPath, 1) "\" _
Then strPath = strPath + "\"
End With


If Documents.Count 0 Then
Documents.Close SaveChanges:=wdPromptToSaveChanges
End If
If Left(strPath, 1) = Chr(34) Then
strPath = Mid(strPath, 2, Len(strPath) - 2)
End If
strFilename = Dir$(strPath & "*.dot")


While Len(strFilename) 0
Set oDoc = Documents.Open(strPath & strFilename)
'
'Do what you want with oDoc e.g.
oDoc.Variables("varAddress").Value = sAddr1 & Chr(13) & _
sAddr2 & Chr(13) & sAddr3 & Chr(13) & sAddr4
oDoc.Variables("varPhone").Value = sPhone
oDoc.Fields.Update
'
oDoc.Close SaveChanges:=wdSaveChanges
strFilename = Dir$()
Wend
End Sub


--

Graham Mayor - Word MVP


My web sitewww.gmayor.com
Word MVP web sitehttp://word.mvps.org


"BD" wrote in message


....
Thank you for suggestion.


In order to your first suggestion I should be able to change this
macro to work properly, but I don't fully understand your second one.
Replace it with bookmarked section? What do you mean exactly? How can
I do this?


How about new templates? I will have to create 15 new contracts and
again with different content and the same Header and Footer. Is there
a way to create new files with capability to changing Headers and
Footers automatic in all those new files?


Best regards,
BD.


On 12 Mar, 10:03, "Graham Mayor" wrote:


With existing templates you have two choices. Either use a batch replace
process to replace the changed text in the
templates -http://www.gmayor.com/batch_replace.htmshouldgetyou started
though you
will need to change the line myFile = Dir$(PathToUse & "*.doc") to
myFile
=
Dir$(PathToUse & "*.dot") - or replace the header footer information
with
linked bookmarked sections from another document (which will only really
be
of benefit of you plan on moving often).


--

Graham Mayor - Word MVP


My web sitewww.gmayor.com
Word MVP web sitehttp://word.mvps.org


"Bartosz Dlugokecki" wrote in message


....


Hello and welcome,


In my company I have about 20 different contracts' templates. They all
have different content but the same Header and Footer with company's
logo and address.


What I would like to do is to have one file with Header and Footer
where I could change company's address, and it would update those 20
files automatic.


Do you have any ideas or solutions to this problem?


Please let me know.


Best regards,
BD.


  #15   Report Post  
Posted to microsoft.public.word.docmanagement
BD BD is offline
external usenet poster
 
Posts: 8
Default Word 2003 - Dynamic Templates

To be honest I don't know what script editor is for, I've just seen
that header.htm file and asked. =)

What if I would not use templates and instead of them I use normal
document. Would it make this whole operation easier? The clue is that
this Header and Footer is changing approximately 1-2 times a month,
because it contains other data then address. Therefore I need to be
able to easily edit this Header. Macro doesn't seems to solve
formatting problem and imputing images, etc.

Best regards,
BD.

On 12 Mar, 12:29, "Graham Mayor" wrote:
You cannot open a template in the script editor.
Why work in the script editor when you can work in the template?

--

Graham Mayor - *Word MVP

My web sitewww.gmayor.com
Word MVP web sitehttp://word.mvps.org


"BD" wrote in message

...
Thank you for your suggestions.

I'm wondering if it's possible to to use 'header.htm' which is visible
in Microsoft Script Editor and create a macro which will replace
'header.htm' file in this every Contracts Files with 'Template
Header'?

What do you think?

BD

On 12 Mar, 10:59, "Graham Mayor" wrote:

To implement the second option you would have to recreate all your
templates
using includetext and/or includepicture fields in place of the address and
logo . It is not worth the hassle unless you change address often. If the
templates all use the same header information, it is probably still
simpler
to batch replace the old header address with the new one.It would be easy
enough to modify the macro to target the information specifically.


If starting again from scratch, then I would also consider using
docvariable
fields to display the address information, but again you would need to use
a
macro to batch update the templates to change the content of the
docvariables. eg the following macro will update the docvariable fields
{DocVariable varAddress} and {DocVariable varPhone} with the new
information
gathered from the macro. Actually it wouldn't be that much more difficult
to
replace the address with the docvariable fields by macro also.


Sub BatchProcess()
Dim strFilename As String
Dim strPath As String
Dim oDoc As Document
Dim fDialog As FileDialog
Dim sAddr1 As String
Dim sAddr2 As String
Dim sAddr3 As String
Dim sAddr4 As String
Dim sPhone As String


sAddr1 = InputBox("Address Line 1?")
sAddr2 = InputBox("Address Line 2?")
sAddr3 = InputBox("Address Line 3?")
sAddr4 = InputBox("Address Line 4?")
sPhone = InputBox("Phone Number?")


Set fDialog = Application.FileDialog(msoFileDialogFolderPicker)


With fDialog
.Title = "Select folder and click OK"
.AllowMultiSelect = False
.InitialView = msoFileDialogViewList
If .Show -1 Then
MsgBox "Cancelled By User", , _
"List Folder Contents"
Exit Sub
End If
strPath = fDialog.SelectedItems.Item(1)
If Right(strPath, 1) "\" _
Then strPath = strPath + "\"
End With


If Documents.Count 0 Then
Documents.Close SaveChanges:=wdPromptToSaveChanges
End If
If Left(strPath, 1) = Chr(34) Then
strPath = Mid(strPath, 2, Len(strPath) - 2)
End If
strFilename = Dir$(strPath & "*.dot")


While Len(strFilename) 0
Set oDoc = Documents.Open(strPath & strFilename)
'
'Do what you want with oDoc e.g.
oDoc.Variables("varAddress").Value = sAddr1 & Chr(13) & _
sAddr2 & Chr(13) & sAddr3 & Chr(13) & sAddr4
oDoc.Variables("varPhone").Value = sPhone
oDoc.Fields.Update
'
oDoc.Close SaveChanges:=wdSaveChanges
strFilename = Dir$()
Wend
End Sub


--

Graham Mayor - Word MVP


My web sitewww.gmayor.com
Word MVP web sitehttp://word.mvps.org


"BD" wrote in message


....
Thank you for suggestion.


In order to your first suggestion I should be able to change this
macro to work properly, but I don't fully understand your second one.
Replace it with bookmarked section? What do you mean exactly? How can
I do this?


How about new templates? I will have to create 15 new contracts and
again with different content and the same Header and Footer. Is there
a way to create new files with capability to changing Headers and
Footers automatic in all those new files?


Best regards,
BD.


On 12 Mar, 10:03, "Graham Mayor" wrote:


With existing templates you have two choices. Either use a batch replace
process to replace the changed text in the
templates -http://www.gmayor.com/batch_replace.htmshouldgetyou started
though you
will need to change the line myFile = Dir$(PathToUse & "*.doc") to
myFile
=
Dir$(PathToUse & "*.dot") - or replace the header footer information
with
linked bookmarked sections from another document (which will only really
be
of benefit of you plan on moving often).


--

Graham Mayor - Word MVP


My web sitewww.gmayor.com
Word MVP web sitehttp://word.mvps.org


"Bartosz Dlugokecki" wrote in message


....


Hello and welcome,


In my company I have about 20 different contracts' templates. They all
have different content but the same Header and Footer with company's
logo and address.


What I would like to do is to have one file with Header and Footer
where I could change company's address, and it would update those 20
files automatic.


Do you have any ideas or solutions to this problem?


Please let me know.


Best regards,
BD.




  #16   Report Post  
Posted to microsoft.public.word.docmanagement
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default Word 2003 - Dynamic Templates

Perhaps if you told us *exactly* what needs to be changed (and where) and
how the templates are used, we may have a better idea how to deal with it.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org




"BD" wrote in message
...
To be honest I don't know what script editor is for, I've just seen
that header.htm file and asked. =)

What if I would not use templates and instead of them I use normal
document. Would it make this whole operation easier? The clue is that
this Header and Footer is changing approximately 1-2 times a month,
because it contains other data then address. Therefore I need to be
able to easily edit this Header. Macro doesn't seems to solve
formatting problem and imputing images, etc.

Best regards,
BD.

On 12 Mar, 12:29, "Graham Mayor" wrote:
You cannot open a template in the script editor.
Why work in the script editor when you can work in the template?

--

Graham Mayor - Word MVP

My web sitewww.gmayor.com
Word MVP web sitehttp://word.mvps.org


"BD" wrote in message

...
Thank you for your suggestions.

I'm wondering if it's possible to to use 'header.htm' which is visible
in Microsoft Script Editor and create a macro which will replace
'header.htm' file in this every Contracts Files with 'Template
Header'?

What do you think?

BD

On 12 Mar, 10:59, "Graham Mayor" wrote:

To implement the second option you would have to recreate all your
templates
using includetext and/or includepicture fields in place of the address
and
logo . It is not worth the hassle unless you change address often. If
the
templates all use the same header information, it is probably still
simpler
to batch replace the old header address with the new one.It would be
easy
enough to modify the macro to target the information specifically.


If starting again from scratch, then I would also consider using
docvariable
fields to display the address information, but again you would need to
use
a
macro to batch update the templates to change the content of the
docvariables. eg the following macro will update the docvariable fields
{DocVariable varAddress} and {DocVariable varPhone} with the new
information
gathered from the macro. Actually it wouldn't be that much more
difficult
to
replace the address with the docvariable fields by macro also.


Sub BatchProcess()
Dim strFilename As String
Dim strPath As String
Dim oDoc As Document
Dim fDialog As FileDialog
Dim sAddr1 As String
Dim sAddr2 As String
Dim sAddr3 As String
Dim sAddr4 As String
Dim sPhone As String


sAddr1 = InputBox("Address Line 1?")
sAddr2 = InputBox("Address Line 2?")
sAddr3 = InputBox("Address Line 3?")
sAddr4 = InputBox("Address Line 4?")
sPhone = InputBox("Phone Number?")


Set fDialog = Application.FileDialog(msoFileDialogFolderPicker)


With fDialog
.Title = "Select folder and click OK"
.AllowMultiSelect = False
.InitialView = msoFileDialogViewList
If .Show -1 Then
MsgBox "Cancelled By User", , _
"List Folder Contents"
Exit Sub
End If
strPath = fDialog.SelectedItems.Item(1)
If Right(strPath, 1) "\" _
Then strPath = strPath + "\"
End With


If Documents.Count 0 Then
Documents.Close SaveChanges:=wdPromptToSaveChanges
End If
If Left(strPath, 1) = Chr(34) Then
strPath = Mid(strPath, 2, Len(strPath) - 2)
End If
strFilename = Dir$(strPath & "*.dot")


While Len(strFilename) 0
Set oDoc = Documents.Open(strPath & strFilename)
'
'Do what you want with oDoc e.g.
oDoc.Variables("varAddress").Value = sAddr1 & Chr(13) & _
sAddr2 & Chr(13) & sAddr3 & Chr(13) & sAddr4
oDoc.Variables("varPhone").Value = sPhone
oDoc.Fields.Update
'
oDoc.Close SaveChanges:=wdSaveChanges
strFilename = Dir$()
Wend
End Sub


--

Graham Mayor - Word MVP


My web sitewww.gmayor.com
Word MVP web sitehttp://word.mvps.org


"BD" wrote in message


...
Thank you for suggestion.


In order to your first suggestion I should be able to change this
macro to work properly, but I don't fully understand your second one.
Replace it with bookmarked section? What do you mean exactly? How can
I do this?


How about new templates? I will have to create 15 new contracts and
again with different content and the same Header and Footer. Is there
a way to create new files with capability to changing Headers and
Footers automatic in all those new files?


Best regards,
BD.


On 12 Mar, 10:03, "Graham Mayor" wrote:


With existing templates you have two choices. Either use a batch
replace
process to replace the changed text in the
templates -http://www.gmayor.com/batch_replace.htmshouldgetyou started
though you
will need to change the line myFile = Dir$(PathToUse & "*.doc") to
myFile
=
Dir$(PathToUse & "*.dot") - or replace the header footer information
with
linked bookmarked sections from another document (which will only
really
be
of benefit of you plan on moving often).


--

Graham Mayor - Word MVP


My web sitewww.gmayor.com
Word MVP web sitehttp://word.mvps.org


"Bartosz Dlugokecki" wrote in message


...


Hello and welcome,


In my company I have about 20 different contracts' templates. They
all
have different content but the same Header and Footer with company's
logo and address.


What I would like to do is to have one file with Header and Footer
where I could change company's address, and it would update those 20
files automatic.


Do you have any ideas or solutions to this problem?


Please let me know.


Best regards,
BD.



  #17   Report Post  
Posted to microsoft.public.word.docmanagement
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default Word 2003 - Dynamic Templates

Perhaps if you told us *exactly* what needs to be changed (and where) and
how the templates are used, we may have a better idea how to deal with it.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org




"BD" wrote in message
...
To be honest I don't know what script editor is for, I've just seen
that header.htm file and asked. =)

What if I would not use templates and instead of them I use normal
document. Would it make this whole operation easier? The clue is that
this Header and Footer is changing approximately 1-2 times a month,
because it contains other data then address. Therefore I need to be
able to easily edit this Header. Macro doesn't seems to solve
formatting problem and imputing images, etc.

Best regards,
BD.

On 12 Mar, 12:29, "Graham Mayor" wrote:
You cannot open a template in the script editor.
Why work in the script editor when you can work in the template?

--

Graham Mayor - Word MVP

My web sitewww.gmayor.com
Word MVP web sitehttp://word.mvps.org


"BD" wrote in message

...
Thank you for your suggestions.

I'm wondering if it's possible to to use 'header.htm' which is visible
in Microsoft Script Editor and create a macro which will replace
'header.htm' file in this every Contracts Files with 'Template
Header'?

What do you think?

BD

On 12 Mar, 10:59, "Graham Mayor" wrote:

To implement the second option you would have to recreate all your
templates
using includetext and/or includepicture fields in place of the address
and
logo . It is not worth the hassle unless you change address often. If
the
templates all use the same header information, it is probably still
simpler
to batch replace the old header address with the new one.It would be
easy
enough to modify the macro to target the information specifically.


If starting again from scratch, then I would also consider using
docvariable
fields to display the address information, but again you would need to
use
a
macro to batch update the templates to change the content of the
docvariables. eg the following macro will update the docvariable fields
{DocVariable varAddress} and {DocVariable varPhone} with the new
information
gathered from the macro. Actually it wouldn't be that much more
difficult
to
replace the address with the docvariable fields by macro also.


Sub BatchProcess()
Dim strFilename As String
Dim strPath As String
Dim oDoc As Document
Dim fDialog As FileDialog
Dim sAddr1 As String
Dim sAddr2 As String
Dim sAddr3 As String
Dim sAddr4 As String
Dim sPhone As String


sAddr1 = InputBox("Address Line 1?")
sAddr2 = InputBox("Address Line 2?")
sAddr3 = InputBox("Address Line 3?")
sAddr4 = InputBox("Address Line 4?")
sPhone = InputBox("Phone Number?")


Set fDialog = Application.FileDialog(msoFileDialogFolderPicker)


With fDialog
.Title = "Select folder and click OK"
.AllowMultiSelect = False
.InitialView = msoFileDialogViewList
If .Show -1 Then
MsgBox "Cancelled By User", , _
"List Folder Contents"
Exit Sub
End If
strPath = fDialog.SelectedItems.Item(1)
If Right(strPath, 1) "\" _
Then strPath = strPath + "\"
End With


If Documents.Count 0 Then
Documents.Close SaveChanges:=wdPromptToSaveChanges
End If
If Left(strPath, 1) = Chr(34) Then
strPath = Mid(strPath, 2, Len(strPath) - 2)
End If
strFilename = Dir$(strPath & "*.dot")


While Len(strFilename) 0
Set oDoc = Documents.Open(strPath & strFilename)
'
'Do what you want with oDoc e.g.
oDoc.Variables("varAddress").Value = sAddr1 & Chr(13) & _
sAddr2 & Chr(13) & sAddr3 & Chr(13) & sAddr4
oDoc.Variables("varPhone").Value = sPhone
oDoc.Fields.Update
'
oDoc.Close SaveChanges:=wdSaveChanges
strFilename = Dir$()
Wend
End Sub


--

Graham Mayor - Word MVP


My web sitewww.gmayor.com
Word MVP web sitehttp://word.mvps.org


"BD" wrote in message


...
Thank you for suggestion.


In order to your first suggestion I should be able to change this
macro to work properly, but I don't fully understand your second one.
Replace it with bookmarked section? What do you mean exactly? How can
I do this?


How about new templates? I will have to create 15 new contracts and
again with different content and the same Header and Footer. Is there
a way to create new files with capability to changing Headers and
Footers automatic in all those new files?


Best regards,
BD.


On 12 Mar, 10:03, "Graham Mayor" wrote:


With existing templates you have two choices. Either use a batch
replace
process to replace the changed text in the
templates -http://www.gmayor.com/batch_replace.htmshouldgetyou started
though you
will need to change the line myFile = Dir$(PathToUse & "*.doc") to
myFile
=
Dir$(PathToUse & "*.dot") - or replace the header footer information
with
linked bookmarked sections from another document (which will only
really
be
of benefit of you plan on moving often).


--

Graham Mayor - Word MVP


My web sitewww.gmayor.com
Word MVP web sitehttp://word.mvps.org


"Bartosz Dlugokecki" wrote in message


...


Hello and welcome,


In my company I have about 20 different contracts' templates. They
all
have different content but the same Header and Footer with company's
logo and address.


What I would like to do is to have one file with Header and Footer
where I could change company's address, and it would update those 20
files automatic.


Do you have any ideas or solutions to this problem?


Please let me know.


Best regards,
BD.



Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Dynamic content in word via XML Silent Fury Microsoft Word Help 2 March 12th 10 06:23 AM
Copy dynamic image from IE to Word 2003 bohly Microsoft Word Help 0 October 13th 06 02:57 PM
Dynamic word document Neno Bojic Microsoft Word Help 1 May 17th 06 10:30 AM
Merge Dynamic Email and Dynamic Letter Viona Mailmerge 3 November 29th 05 09:55 PM
Dynamic Templates? Format changes based on length of document? The Yogurt Man Microsoft Word Help 5 October 6th 05 07:15 PM


All times are GMT +1. The time now is 07:14 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"