Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Tom Stian Tom Stian is offline
external usenet poster
 
Posts: 1
Default includepicture and path to picture

Hi all!

Hope you can help me with this question. I've been browsing the web for an
answer to my problem, but all the solutions I find are based on that the path
to a picture is static. Mine, however is not.

The background:
In a CRM/ERP program, you can link a picture to a product. This is stored in
a table (SQL) as the path to the picture (example:
\\server\Picture\Product\Table\Pic1.jpg), and not the picture itself. This
means that I cannot create an INCLUDEPICTURE using a static path to the
pictures, as the path is part of the field I have to retrieve from the table.

I've come this far, but I can't seem to get to the finish line:
{ INCLUDEPICTURE "{ Report.Get("g_Prod", "Picture") }" \d \* MERGEFORMAT }

Where { Report.Get("g_Prod", "Picture") } retrieves the path to the picture.
I don't think this is an integrated code in Word, but an addon created by the
CRM/ERP company.

This creates the red cross picture, and when i Alt+F9 it, it gives me the
following:
{ INCLUDEPICTURE "\\server\Picture\Product\Table\Pic1.jpg" \d \* MERGEFORMAT }

I then have to edit the field, put two additional \\ in front of \\server
and press OK, and the picture works.

I've also tried:
{ INCLUDEPICTURE "\\{ Report.Get("g_Prod", "Picture") }" \d \* MERGEFORMAT }

This gives me the following value:
{ INCLUDEPICTURE "\\\\server\Picture\Product\Table\Pic1.jpg" \d \*
MERGEFORMAT }

But no picture. Still have to edit the field, but can now press only OK to
make it leap into action.

My question is therefore.. Is there a code I can use to replace singel \
with \\ in the mergefield, or is there any way I can change the path to the
picture without doing it manually? Maybe use a different mergefield to change
normal path to \\\\server\\picture\\and_so_on

Example:
{ INCLUDEPICTURE "{=REPLACE({ Report.Get("g_Prod", "Picture") }, "\", "\\"}"
\d \* MERGEFORMAT }

All help will be appreciated!

Regards,

Escariot
  #2   Report Post  
Posted to microsoft.public.word.mailmerge.fields
macropod[_2_] macropod[_2_] is offline
external usenet poster
 
Posts: 2,059
Default includepicture and path to picture

Hi Tom,

Can you change the path separators from \ to / in the source file? That would probably fix the problem. An alternative would be to
replace each path separator with \\ or / via a macro after merging.

Also, you can get rid of the '\* MERGEFORMAT' switch - AFAIK it does nothing useful for INCLUDEPICTURE fields.

--
Cheers
macropod
[MVP - Microsoft Word]


"Tom Stian" wrote in message ...
Hi all!

Hope you can help me with this question. I've been browsing the web for an
answer to my problem, but all the solutions I find are based on that the path
to a picture is static. Mine, however is not.

The background:
In a CRM/ERP program, you can link a picture to a product. This is stored in
a table (SQL) as the path to the picture (example:
\\server\Picture\Product\Table\Pic1.jpg), and not the picture itself. This
means that I cannot create an INCLUDEPICTURE using a static path to the
pictures, as the path is part of the field I have to retrieve from the table.

I've come this far, but I can't seem to get to the finish line:
{ INCLUDEPICTURE "{ Report.Get("g_Prod", "Picture") }" \d \* MERGEFORMAT }

Where { Report.Get("g_Prod", "Picture") } retrieves the path to the picture.
I don't think this is an integrated code in Word, but an addon created by the
CRM/ERP company.

This creates the red cross picture, and when i Alt+F9 it, it gives me the
following:
{ INCLUDEPICTURE "\\server\Picture\Product\Table\Pic1.jpg" \d \* MERGEFORMAT }

I then have to edit the field, put two additional \\ in front of \\server
and press OK, and the picture works.

I've also tried:
{ INCLUDEPICTURE "\\{ Report.Get("g_Prod", "Picture") }" \d \* MERGEFORMAT }

This gives me the following value:
{ INCLUDEPICTURE "\\\\server\Picture\Product\Table\Pic1.jpg" \d \*
MERGEFORMAT }

But no picture. Still have to edit the field, but can now press only OK to
make it leap into action.

My question is therefore.. Is there a code I can use to replace singel \
with \\ in the mergefield, or is there any way I can change the path to the
picture without doing it manually? Maybe use a different mergefield to change
normal path to \\\\server\\picture\\and_so_on

Example:
{ INCLUDEPICTURE "{=REPLACE({ Report.Get("g_Prod", "Picture") }, "\", "\\"}"
\d \* MERGEFORMAT }

All help will be appreciated!

Regards,

Escariot


  #3   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Escariot Escariot is offline
external usenet poster
 
Posts: 1
Default includepicture and path to picture

Hi, and thank you for the swift reply.

I am not able to change anything in the SQL-table. If I do, then the
OLE/Active-X object in the report generator (Visual FoxPro 9) will not print
the picture, and the picture is not viewable from product information.

Sadly, I'm not familiar with VB macros, so I have no clue as to how to write
such a scipt )

Are there no mergefield or other code that can convert \\server\and_so_on to
\\\\server\\and_so_on (or /server/and_so_on for that matter)?

Cheers
Tom

"macropod" wrote:

Hi Tom,

Can you change the path separators from \ to / in the source file? That would probably fix the problem. An alternative would be to
replace each path separator with \\ or / via a macro after merging.

Also, you can get rid of the '\* MERGEFORMAT' switch - AFAIK it does nothing useful for INCLUDEPICTURE fields.

--
Cheers
macropod
[MVP - Microsoft Word]


"Tom Stian" wrote in message ...
Hi all!

Hope you can help me with this question. I've been browsing the web for an
answer to my problem, but all the solutions I find are based on that the path
to a picture is static. Mine, however is not.

The background:
In a CRM/ERP program, you can link a picture to a product. This is stored in
a table (SQL) as the path to the picture (example:
\\server\Picture\Product\Table\Pic1.jpg), and not the picture itself. This
means that I cannot create an INCLUDEPICTURE using a static path to the
pictures, as the path is part of the field I have to retrieve from the table.

I've come this far, but I can't seem to get to the finish line:
{ INCLUDEPICTURE "{ Report.Get("g_Prod", "Picture") }" \d \* MERGEFORMAT }

Where { Report.Get("g_Prod", "Picture") } retrieves the path to the picture.
I don't think this is an integrated code in Word, but an addon created by the
CRM/ERP company.

This creates the red cross picture, and when i Alt+F9 it, it gives me the
following:
{ INCLUDEPICTURE "\\server\Picture\Product\Table\Pic1.jpg" \d \* MERGEFORMAT }

I then have to edit the field, put two additional \\ in front of \\server
and press OK, and the picture works.

I've also tried:
{ INCLUDEPICTURE "\\{ Report.Get("g_Prod", "Picture") }" \d \* MERGEFORMAT }

This gives me the following value:
{ INCLUDEPICTURE "\\\\server\Picture\Product\Table\Pic1.jpg" \d \*
MERGEFORMAT }

But no picture. Still have to edit the field, but can now press only OK to
make it leap into action.

My question is therefore.. Is there a code I can use to replace singel \
with \\ in the mergefield, or is there any way I can change the path to the
picture without doing it manually? Maybe use a different mergefield to change
normal path to \\\\server\\picture\\and_so_on

Example:
{ INCLUDEPICTURE "{=REPLACE({ Report.Get("g_Prod", "Picture") }, "\", "\\"}"
\d \* MERGEFORMAT }

All help will be appreciated!

Regards,

Escariot



  #4   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Tom Stian[_2_] Tom Stian[_2_] is offline
external usenet poster
 
Posts: 1
Default includepicture and path to picture

Hi macropod, and thanks for the swift reply!

It is not possible to change the field in the SQL-table, as this will
corrupt the picture when using it as an OLE/Active-X object in the integrated
report generator (MS Visual FoxPro 9), and when viewing the picture from the
product module in the program itself.

Sadly, I'm not familiar with creating macros, so it does not seem like an
option to me )

Is there no way, using a different mergefield or switch or code to convert
\\server\and_so_on\ to \\\\server\\and_so_on\\ (or /server/and_so_on/ for
that matter)?

Cheers

Tom

"macropod" wrote:

Hi Tom,

Can you change the path separators from \ to / in the source file? That would probably fix the problem. An alternative would be to
replace each path separator with \\ or / via a macro after merging.

Also, you can get rid of the '\* MERGEFORMAT' switch - AFAIK it does nothing useful for INCLUDEPICTURE fields.

--
Cheers
macropod
[MVP - Microsoft Word]


"Tom Stian" wrote in message ...
Hi all!

Hope you can help me with this question. I've been browsing the web for an
answer to my problem, but all the solutions I find are based on that the path
to a picture is static. Mine, however is not.

The background:
In a CRM/ERP program, you can link a picture to a product. This is stored in
a table (SQL) as the path to the picture (example:
\\server\Picture\Product\Table\Pic1.jpg), and not the picture itself. This
means that I cannot create an INCLUDEPICTURE using a static path to the
pictures, as the path is part of the field I have to retrieve from the table.

I've come this far, but I can't seem to get to the finish line:
{ INCLUDEPICTURE "{ Report.Get("g_Prod", "Picture") }" \d \* MERGEFORMAT }

Where { Report.Get("g_Prod", "Picture") } retrieves the path to the picture.
I don't think this is an integrated code in Word, but an addon created by the
CRM/ERP company.

This creates the red cross picture, and when i Alt+F9 it, it gives me the
following:
{ INCLUDEPICTURE "\\server\Picture\Product\Table\Pic1.jpg" \d \* MERGEFORMAT }

I then have to edit the field, put two additional \\ in front of \\server
and press OK, and the picture works.

I've also tried:
{ INCLUDEPICTURE "\\{ Report.Get("g_Prod", "Picture") }" \d \* MERGEFORMAT }

This gives me the following value:
{ INCLUDEPICTURE "\\\\server\Picture\Product\Table\Pic1.jpg" \d \*
MERGEFORMAT }

But no picture. Still have to edit the field, but can now press only OK to
make it leap into action.

My question is therefore.. Is there a code I can use to replace singel \
with \\ in the mergefield, or is there any way I can change the path to the
picture without doing it manually? Maybe use a different mergefield to change
normal path to \\\\server\\picture\\and_so_on

Example:
{ INCLUDEPICTURE "{=REPLACE({ Report.Get("g_Prod", "Picture") }, "\", "\\"}"
\d \* MERGEFORMAT }

All help will be appreciated!

Regards,

Escariot



  #5   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default includepicture and path to picture

If it is possible to use a REPLACE function in FoxPro's dialect of SQL then
you may be able to do this by setting up the data source using Word VBA's
opendatasource call (i.e. some VBA still required). However, I don't have a
copy of FoxPro up and running here so cannot test/explore.

--
Peter Jamieson
http://tips.pjmsn.me.uk

"Tom Stian" wrote in message
...
Hi macropod, and thanks for the swift reply!

It is not possible to change the field in the SQL-table, as this will
corrupt the picture when using it as an OLE/Active-X object in the
integrated
report generator (MS Visual FoxPro 9), and when viewing the picture from
the
product module in the program itself.

Sadly, I'm not familiar with creating macros, so it does not seem like an
option to me )

Is there no way, using a different mergefield or switch or code to convert
\\server\and_so_on\ to \\\\server\\and_so_on\\ (or /server/and_so_on/ for
that matter)?

Cheers

Tom

"macropod" wrote:

Hi Tom,

Can you change the path separators from \ to / in the source file? That
would probably fix the problem. An alternative would be to
replace each path separator with \\ or / via a macro after merging.

Also, you can get rid of the '\* MERGEFORMAT' switch - AFAIK it does
nothing useful for INCLUDEPICTURE fields.

--
Cheers
macropod
[MVP - Microsoft Word]


"Tom Stian" wrote in message
...
Hi all!

Hope you can help me with this question. I've been browsing the web for
an
answer to my problem, but all the solutions I find are based on that
the path
to a picture is static. Mine, however is not.

The background:
In a CRM/ERP program, you can link a picture to a product. This is
stored in
a table (SQL) as the path to the picture (example:
\\server\Picture\Product\Table\Pic1.jpg), and not the picture itself.
This
means that I cannot create an INCLUDEPICTURE using a static path to the
pictures, as the path is part of the field I have to retrieve from the
table.

I've come this far, but I can't seem to get to the finish line:
{ INCLUDEPICTURE "{ Report.Get("g_Prod", "Picture") }" \d \*
MERGEFORMAT }

Where { Report.Get("g_Prod", "Picture") } retrieves the path to the
picture.
I don't think this is an integrated code in Word, but an addon created
by the
CRM/ERP company.

This creates the red cross picture, and when i Alt+F9 it, it gives me
the
following:
{ INCLUDEPICTURE "\\server\Picture\Product\Table\Pic1.jpg" \d \*
MERGEFORMAT }

I then have to edit the field, put two additional \\ in front of
\\server
and press OK, and the picture works.

I've also tried:
{ INCLUDEPICTURE "\\{ Report.Get("g_Prod", "Picture") }" \d \*
MERGEFORMAT }

This gives me the following value:
{ INCLUDEPICTURE "\\\\server\Picture\Product\Table\Pic1.jpg" \d \*
MERGEFORMAT }

But no picture. Still have to edit the field, but can now press only OK
to
make it leap into action.

My question is therefore.. Is there a code I can use to replace singel
\
with \\ in the mergefield, or is there any way I can change the path
to the
picture without doing it manually? Maybe use a different mergefield to
change
normal path to \\\\server\\picture\\and_so_on

Example:
{ INCLUDEPICTURE "{=REPLACE({ Report.Get("g_Prod", "Picture") }, "\",
"\\"}"
\d \* MERGEFORMAT }

All help will be appreciated!

Regards,

Escariot






  #6   Report Post  
Posted to microsoft.public.word.mailmerge.fields
macropod[_2_] macropod[_2_] is offline
external usenet poster
 
Posts: 2,059
Default includepicture and path to picture

Hi Tom,

On reflection, you can also delete the '\d' switch, reducing your INCLUDEPICTURE mergefield to:
{INCLUDEPICTURE "{ Report.Get("g_Prod", "Picture") }"}

Having deleted the '\d' switch, here are two ways to change the field code after the mailmerge:
.. WITHOUT a macro -
. Press Alt-F9
. Use Find/Replace, with '\' as the Find string and '/' as the Replace string
This will only work for you if the document has no other '\' characters.
.. WITHOUT a macro -
. Add the following code to, say, your Normal.dot template.

Sub FixMergePaths()
Dim oFld As Field
With ActiveDocument
For Each oFld In .Fields
If oFld.Type = wdFieldIncludePicture Then _
oFld.Code.Text = Replace(oFld.Code.Text, "/", "\")
Next
End With
End Sub

--
Cheers
macropod
[MVP - Microsoft Word]


"Tom Stian" wrote in message ...
Hi macropod, and thanks for the swift reply!

It is not possible to change the field in the SQL-table, as this will
corrupt the picture when using it as an OLE/Active-X object in the integrated
report generator (MS Visual FoxPro 9), and when viewing the picture from the
product module in the program itself.

Sadly, I'm not familiar with creating macros, so it does not seem like an
option to me )

Is there no way, using a different mergefield or switch or code to convert
\\server\and_so_on\ to \\\\server\\and_so_on\\ (or /server/and_so_on/ for
that matter)?

Cheers

Tom

"macropod" wrote:

Hi Tom,

Can you change the path separators from \ to / in the source file? That would probably fix the problem. An alternative would be
to
replace each path separator with \\ or / via a macro after merging.

Also, you can get rid of the '\* MERGEFORMAT' switch - AFAIK it does nothing useful for INCLUDEPICTURE fields.

--
Cheers
macropod
[MVP - Microsoft Word]


"Tom Stian" wrote in message ...
Hi all!

Hope you can help me with this question. I've been browsing the web for an
answer to my problem, but all the solutions I find are based on that the path
to a picture is static. Mine, however is not.

The background:
In a CRM/ERP program, you can link a picture to a product. This is stored in
a table (SQL) as the path to the picture (example:
\\server\Picture\Product\Table\Pic1.jpg), and not the picture itself. This
means that I cannot create an INCLUDEPICTURE using a static path to the
pictures, as the path is part of the field I have to retrieve from the table.

I've come this far, but I can't seem to get to the finish line:
{ INCLUDEPICTURE "{ Report.Get("g_Prod", "Picture") }" \d \* MERGEFORMAT }

Where { Report.Get("g_Prod", "Picture") } retrieves the path to the picture.
I don't think this is an integrated code in Word, but an addon created by the
CRM/ERP company.

This creates the red cross picture, and when i Alt+F9 it, it gives me the
following:
{ INCLUDEPICTURE "\\server\Picture\Product\Table\Pic1.jpg" \d \* MERGEFORMAT }

I then have to edit the field, put two additional \\ in front of \\server
and press OK, and the picture works.

I've also tried:
{ INCLUDEPICTURE "\\{ Report.Get("g_Prod", "Picture") }" \d \* MERGEFORMAT }

This gives me the following value:
{ INCLUDEPICTURE "\\\\server\Picture\Product\Table\Pic1.jpg" \d \*
MERGEFORMAT }

But no picture. Still have to edit the field, but can now press only OK to
make it leap into action.

My question is therefore.. Is there a code I can use to replace singel \
with \\ in the mergefield, or is there any way I can change the path to the
picture without doing it manually? Maybe use a different mergefield to change
normal path to \\\\server\\picture\\and_so_on

Example:
{ INCLUDEPICTURE "{=REPLACE({ Report.Get("g_Prod", "Picture") }, "\", "\\"}"
\d \* MERGEFORMAT }

All help will be appreciated!

Regards,

Escariot




  #7   Report Post  
Posted to microsoft.public.word.mailmerge.fields
macropod[_2_] macropod[_2_] is offline
external usenet poster
 
Posts: 2,059
Default includepicture and path to picture

Hi Tom,

Actually, a better rendition of the macro for your purposes might be:

Sub FixMergePaths()
Dim oFld As Field
With ActiveDocument
For Each oFld In .Fields
With oFld
If .Type = wdFieldIncludePicture Then
.Code.Text = Replace( .Code.Text, "/", "\")
.Update
.Unlink
End If
End With
Next
End With
End Sub

The modified code updates the field then unlinks the picture from the source file.

--
Cheers
macropod
[MVP - Microsoft Word]


"macropod" wrote in message ...
Hi Tom,

On reflection, you can also delete the '\d' switch, reducing your INCLUDEPICTURE mergefield to:
{INCLUDEPICTURE "{ Report.Get("g_Prod", "Picture") }"}

Having deleted the '\d' switch, here are two ways to change the field code after the mailmerge:
. WITHOUT a macro -
. Press Alt-F9
. Use Find/Replace, with '\' as the Find string and '/' as the Replace string
This will only work for you if the document has no other '\' characters.
. WITHOUT a macro -
. Add the following code to, say, your Normal.dot template.

Sub FixMergePaths()
Dim oFld As Field
With ActiveDocument
For Each oFld In .Fields
If oFld.Type = wdFieldIncludePicture Then _
oFld.Code.Text = Replace(oFld.Code.Text, "/", "\")
Next
End With
End Sub

--
Cheers
macropod
[MVP - Microsoft Word]


"Tom Stian" wrote in message ...
Hi macropod, and thanks for the swift reply!

It is not possible to change the field in the SQL-table, as this will
corrupt the picture when using it as an OLE/Active-X object in the integrated
report generator (MS Visual FoxPro 9), and when viewing the picture from the
product module in the program itself.

Sadly, I'm not familiar with creating macros, so it does not seem like an
option to me )

Is there no way, using a different mergefield or switch or code to convert
\\server\and_so_on\ to \\\\server\\and_so_on\\ (or /server/and_so_on/ for
that matter)?

Cheers

Tom

"macropod" wrote:

Hi Tom,

Can you change the path separators from \ to / in the source file? That would probably fix the problem. An alternative would be
to
replace each path separator with \\ or / via a macro after merging.

Also, you can get rid of the '\* MERGEFORMAT' switch - AFAIK it does nothing useful for INCLUDEPICTURE fields.

--
Cheers
macropod
[MVP - Microsoft Word]


"Tom Stian" wrote in message ...
Hi all!

Hope you can help me with this question. I've been browsing the web for an
answer to my problem, but all the solutions I find are based on that the path
to a picture is static. Mine, however is not.

The background:
In a CRM/ERP program, you can link a picture to a product. This is stored in
a table (SQL) as the path to the picture (example:
\\server\Picture\Product\Table\Pic1.jpg), and not the picture itself. This
means that I cannot create an INCLUDEPICTURE using a static path to the
pictures, as the path is part of the field I have to retrieve from the table.

I've come this far, but I can't seem to get to the finish line:
{ INCLUDEPICTURE "{ Report.Get("g_Prod", "Picture") }" \d \* MERGEFORMAT }

Where { Report.Get("g_Prod", "Picture") } retrieves the path to the picture.
I don't think this is an integrated code in Word, but an addon created by the
CRM/ERP company.

This creates the red cross picture, and when i Alt+F9 it, it gives me the
following:
{ INCLUDEPICTURE "\\server\Picture\Product\Table\Pic1.jpg" \d \* MERGEFORMAT }

I then have to edit the field, put two additional \\ in front of \\server
and press OK, and the picture works.

I've also tried:
{ INCLUDEPICTURE "\\{ Report.Get("g_Prod", "Picture") }" \d \* MERGEFORMAT }

This gives me the following value:
{ INCLUDEPICTURE "\\\\server\Picture\Product\Table\Pic1.jpg" \d \*
MERGEFORMAT }

But no picture. Still have to edit the field, but can now press only OK to
make it leap into action.

My question is therefore.. Is there a code I can use to replace singel \
with \\ in the mergefield, or is there any way I can change the path to the
picture without doing it manually? Maybe use a different mergefield to change
normal path to \\\\server\\picture\\and_so_on

Example:
{ INCLUDEPICTURE "{=REPLACE({ Report.Get("g_Prod", "Picture") }, "\", "\\"}"
\d \* MERGEFORMAT }

All help will be appreciated!

Regards,

Escariot




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
Problem with includepicture - same picture repeated everywhere Wabiloo Mailmerge 2 December 6th 06 02:03 PM
Picture always updated - IncludePicture and If Serafim Mailmerge 0 September 2nd 06 02:22 PM
IncludePicture path Debbie New Users 2 January 3rd 06 01:31 AM
How do I move and align picture when using INCLUDEPICTURE John J. Dwyer, Sr. Microsoft Word Help 2 July 28th 05 03:09 PM
IncludePicture Repeats the Same Picture Ariana Mailmerge 0 January 19th 05 02:03 PM


All times are GMT +1. The time now is 08:13 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"