IncludePicture field - UNC path

J

John

Hi,

I've built an ADE application that automatically generates
large numbers of Word documents, using an SQL Server
backEnd as datasource. Users are able to include images in
their documents.

I'm using the INCLUDEPICTURE field in Word to
programmatically link to the image files on the server. It
works perfectly, until the app starts to use the central
UNC path setting of the images; I understand that the
INCLUDEPICTURE field considers the UNC path a hyperlink.
How can I solve this (without giving up the use of
INCLUDEPICTURE fields and without giving up the use of UNC
path settings)?
 
C

Cindy M -WordMVP-

Hi John,
I'm using the INCLUDEPICTURE field in Word to
programmatically link to the image files on the server. It
works perfectly, until the app starts to use the central
UNC path setting of the images; I understand that the
INCLUDEPICTURE field considers the UNC path a hyperlink.
How can I solve this (without giving up the use of
INCLUDEPICTURE fields and without giving up the use of UNC
path settings)?
How is your code generating these IncludePicture fields?
Probably not by using the .Add method of the fields
collection? Try doing it that way, instead, in order to get
full control.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Sep
30 2003)
http://www.mvps.org/word

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

John

Hi Cindy,

Thanks for your reply.
The IncludePicture Field is already in the Word template
file when my app starts to generate letters. In my code,
it finds the IncludePicture field in the newly generated
document and uses the following code:

If WordFLD.Type = wdFieldIncludePicture then
If Not IsNull(rsMain.Fields("DefaultImage")) Then
strPictureName = rsMain.Fields("DefaultImage")
strPicturePath = ImagesPath & "\" & strPictureName
'Slashes must be replaced by double
slashes
strPicturePath = Replace(strPicturePath, "\", "\\")

'insert new picture
WordFLD.Code.Text = "INCLUDEPICTURE " & Chr(34) &
strPicturePath & Chr(34) & "" & " \d"
WordFLD.Update

As you can see, the path is packed in a variable that will
be filled by the recordset. It then uses the '.Code.Text'
method to change the pathname for the IncludePicture
Field. This works fine, as long as it is NOT a full UNC
path. So: 'G:\blahblah\etc' works fine,
but '\\ServerX\blahblah\etc' is not recognized. It has
something to do with the double backslashes of the server
name. The field sees it as a URL or something. I searched
all over the net, but I cannot find a solution (swearing
now).
You think there is a way out of here?

Thanks in advance,

John
 
C

Cindy M -WordMVP-

Hi John,
but '\\ServerX\blahblah\etc' is not recognized. It has
something to do with the double backslashes of the server
name.
There should be FOUR backslashes, not just two? (Can't tell
if you've really allowed for this...)

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Sep
30 2003)
http://www.mvps.org/word

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

Guest

Hi Cindy,

I did...but something funny has happened: last weekend we
installed 2003 server and suddenly it seems to work. Maybe
NT has something to do with this????????
I'm going to find out.

Oh, by the way: i took the liberty of checking your site.
Keep up the good work!

Thanks

John.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top