Reply
 
Thread Tools Display Modes
  #1   Report Post  
Birgit
 
Posts: n/a
Default Nested IncludePicture troubles in header table

Hi all!
I have a template where many different logos (.jpgs) are being inserted into
the header of the document. I have the following nested fields in a table in
the header:

{If {DocProperty "Logo1"} = " " "" {IncludePicture {DocProperty "Logo1"}}}

Clear text: if the document property of Logo1 contains only a space do
nothing, otherwise insert the picture with path and name as found in
document property Logo1.

document property Logo1 may contain text as C:\\huisstijl\\testlogo.jpg

On my test PC I run Win XP with Office 2003 SP1. In Office 97 all of this
has worked very well.

It works fine in the body of the template. It does nothing in the header
(also does not work if I remove the table). There are no troubles if I
directly insert the text that is contained in the document property like
this: {If {DocProperty "Logo1"} = " " "" {IncludePicture
C:\\huisstijl\\testlogo.jpg}}. To me this is strange behaviour.

I swap displaying the logo (e-mail) with not displaying the logo (print on
logo paper). So it has always seemed sensible to use this construction with
document properties.

Has something changed fundamentally from Office 97? Does anyone have a
better idea than muking around with bookmarks en recreating the
includePicture field with VBA each time a user decides to display/not
display the bookmark?

Any help and hints are appreciated.
Birgit


  #2   Report Post  
Cindy M -WordMVP-
 
Posts: n/a
Default

Hi Birgit,

They changed how the nested fields interpet paths coming in from another field.
Remove the second backspace, so that the elements of the path in the document
property are separated by only a single backslash.

I have a template where many different logos (.jpgs) are being inserted into
the header of the document. I have the following nested fields in a table in
the header:

{If {DocProperty "Logo1"} = " " "" {IncludePicture {DocProperty "Logo1"}}}

Clear text: if the document property of Logo1 contains only a space do
nothing, otherwise insert the picture with path and name as found in
document property Logo1.

document property Logo1 may contain text as C:\\huisstijl\\testlogo.jpg

On my test PC I run Win XP with Office 2003 SP1. In Office 97 all of this
has worked very well.


Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :-)

  #3   Report Post  
Birgit
 
Posts: n/a
Default

Thanks Cindy,
In which version of Office does this change? And how can I check the user's
version of Office? The code needs to run on all versions unfortunately.

Birgit

"Cindy M -WordMVP-" schreef in bericht
news:VA.0000a783.004ec8b3@speedy...
Hi Birgit,

They changed how the nested fields interpet paths coming in from another
field.
Remove the second backspace, so that the elements of the path in the
document
property are separated by only a single backslash.

I have a template where many different logos (.jpgs) are being inserted
into
the header of the document. I have the following nested fields in a table
in
the header:

{If {DocProperty "Logo1"} = " " "" {IncludePicture {DocProperty
"Logo1"}}}

Clear text: if the document property of Logo1 contains only a space do
nothing, otherwise insert the picture with path and name as found in
document property Logo1.

document property Logo1 may contain text as C:\\huisstijl\\testlogo.jpg

On my test PC I run Win XP with Office 2003 SP1. In Office 97 all of this
has worked very well.


Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply
in the newsgroup and not by e-mail :-)



  #4   Report Post  
Cindy M -WordMVP-
 
Posts: n/a
Default

Hi Birgit,

In which version of Office does this change? And how can I check the user's
version of Office? The code needs to run on all versions unfortunately.

I think it was in 2000. You can check which version using Application.Version

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :-)

  #5   Report Post  
Birgit
 
Posts: n/a
Default

Hi Cindy,
thank you very much for your help. I will try this.

Birgit

"Cindy M -WordMVP-" schreef in bericht
news:VA.0000a797.00652947@speedy...
Hi Birgit,

In which version of Office does this change? And how can I check the
user's
version of Office? The code needs to run on all versions unfortunately.

I think it was in 2000. You can check which version using
Application.Version

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :-)





  #6   Report Post  
Birgit
 
Posts: n/a
Default

Hi all, hi Cindy,
I find I have to use the following code just once after the document has
been assigned its proper logo (I'm glad I don't have to swap logo's once
they are set):

Dim afield As Field
For Each afield In
ActiveDocument.Sections(1).Headers(wdHeaderFooterF irstPage).Range.Fields
On Error Resume Next
If afield.LinkFormat.AutoUpdate = False Then afield.LinkFormat.Update
Next afield

This way the docproperty inside the includepicture seems to be converted to
the text of the documentproperty. The application.version suggestion works
as a treat with this.

I'll implement this for all headers and I think I'll be set.

Thanks again,
Birgit
"Cindy M -WordMVP-" schreef in bericht
news:VA.0000a797.00652947@speedy...
Hi Birgit,

In which version of Office does this change? And how can I check the
user's
version of Office? The code needs to run on all versions unfortunately.

I think it was in 2000. You can check which version using
Application.Version

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :-)



  #7   Report Post  
Birgit
 
Posts: n/a
Default

Hi all,
I now run into problems on updating my second page header which is
unfortunately not completely the same as the firstpage header because it
contains a pagenumber.

If there is not yet a second page when the code is run then the following
code will not give a proper result: No logo if user creates a second page
Any suggestions except to temporarily create a second page?

Birgit
code below:

For i = 1 To myDoc.Sections.Count
' update header (mydoc is generally the active document)
myDoc.Sections(i).Headers(wdHeaderFooterFirstPage) .Range.Fields.Update
'update non-updatables
For Each afield In
myDoc.Sections(i).Headers(wdHeaderFooterFirstPage) .Range.Fields
On Error Resume Next
If afield.LinkFormat.AutoUpdate = False Then
afield.LinkFormat.Update
Next afield
'update header
myDoc.Sections(i).Headers(wdHeaderFooterPrimary).R ange.Fields.Update
'update non-updatables
For Each afield In
myDoc.Sections(i).Headers(wdHeaderFooterPrimary).R ange.Fields
On Error Resume Next
If afield.LinkFormat.AutoUpdate = False Then
afield.LinkFormat.Update
Next afield
Next i


I wrote earlier today:
Hi all, hi Cindy,
I find I have to use the following code just once after the document has
been assigned its proper logo (I'm glad I don't have to swap logo's once
they are set):

Dim afield As Field
For Each afield In
ActiveDocument.Sections(1).Headers(wdHeaderFooterF irstPage).Range.Fields
On Error Resume Next
If afield.LinkFormat.AutoUpdate = False Then afield.LinkFormat.Update
Next afield

This way the docproperty inside the includepicture seems to be converted
to the text of the documentproperty. The application.version suggestion
works as a treat with this.

I'll implement this for all headers and I think I'll be set.

Thanks again,
Birgit
"Cindy M -WordMVP-" schreef in bericht
news:VA.0000a797.00652947@speedy...
Hi Birgit,

In which version of Office does this change? And how can I check the
user's
version of Office? The code needs to run on all versions unfortunately.

I think it was in 2000. You can check which version using
Application.Version

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :-)





  #8   Report Post  
Birgit
 
Posts: n/a
Default

Hi all,
I found a solution to this problem myself: I use a Ref-field which refers to
the includepicture-field on the first page. This works even if the bookmark
is in the body of the document (which I do not run the updatefunction of
non-updatable fields on)

Birgit

"Birgit" schreef in bericht
...
Hi all,
I now run into problems on updating my second page header which is
unfortunately not completely the same as the firstpage header because it
contains a pagenumber.

If there is not yet a second page when the code is run then the following
code will not give a proper result: No logo if user creates a second page

Any suggestions except to temporarily create a second page?

Birgit
code below:

For i = 1 To myDoc.Sections.Count
' update header (mydoc is generally the active document)

myDoc.Sections(i).Headers(wdHeaderFooterFirstPage) .Range.Fields.Update
'update non-updatables
For Each afield In
myDoc.Sections(i).Headers(wdHeaderFooterFirstPage) .Range.Fields
On Error Resume Next
If afield.LinkFormat.AutoUpdate = False Then
afield.LinkFormat.Update
Next afield
'update header

myDoc.Sections(i).Headers(wdHeaderFooterPrimary).R ange.Fields.Update
'update non-updatables
For Each afield In
myDoc.Sections(i).Headers(wdHeaderFooterPrimary).R ange.Fields
On Error Resume Next
If afield.LinkFormat.AutoUpdate = False Then
afield.LinkFormat.Update
Next afield
Next i


I wrote earlier today:
Hi all, hi Cindy,
I find I have to use the following code just once after the document has
been assigned its proper logo (I'm glad I don't have to swap logo's once
they are set):

Dim afield As Field
For Each afield In
ActiveDocument.Sections(1).Headers(wdHeaderFooterF irstPage).Range.Fields
On Error Resume Next
If afield.LinkFormat.AutoUpdate = False Then afield.LinkFormat.Update
Next afield

This way the docproperty inside the includepicture seems to be converted
to the text of the documentproperty. The application.version suggestion
works as a treat with this.

I'll implement this for all headers and I think I'll be set.

Thanks again,
Birgit
"Cindy M -WordMVP-" schreef in bericht
news:VA.0000a797.00652947@speedy...
Hi Birgit,

In which version of Office does this change? And how can I check the
user's
version of Office? The code needs to run on all versions unfortunately.

I think it was in 2000. You can check which version using
Application.Version

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question
or
reply in the newsgroup and not by e-mail :-)







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
Repeat Table Header does not work Timboo Microsoft Word Help 3 January 14th 05 05:12 PM
Table in 1st Page Header shifting to the right when printed Tim Page Layout 4 December 2nd 04 11:39 AM
Word 2003 Table Header Row won't repeat. Linda B Tables 1 November 29th 04 01:28 PM
Repeating Header Row in a table does not convert to PDf correctly Gwen Tables 1 November 3rd 04 01:49 PM


All times are GMT +1. The time now is 12:42 AM.

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"