Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
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
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
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
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
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
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
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
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
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
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
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
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
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 | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Problem with includepicture - same picture repeated everywhere | Mailmerge | |||
Picture always updated - IncludePicture and If | Mailmerge | |||
IncludePicture path | New Users | |||
How do I move and align picture when using INCLUDEPICTURE | Microsoft Word Help | |||
IncludePicture Repeats the Same Picture | Mailmerge |