Re: More stupid INCLUDEPICTURE questions



Peter & Pod :-),

I haven't been able to get the syntax you are describing to work for me but
here is what I have been able to get working. I created an AutoOpen Macro
with the following code:

For Each aVar In ActiveDocument.Variables
If aVar.Name = "MyPath" Then num = aVar.Index
Next aVar
If num = 0 Then
ActiveDocument.Variables.Add Name:="MyPath", Value:=ActiveDocument.Path
& "\"
Else
ActiveDocument.Variables(num).Value = ActiveDocument.Path & "\"
End If
ActiveDocument.Variables(num).Value =
Replace(ActiveDocument.Variables(num).Value, "\", "\\")

My INCLUDEPICTURE looks list this:
{INCLUDEPICTURE "{DOCVARIABLE "MyPath"}{MERGEFIELD picname}.jpg"

.... and all is well. I can now move the main document to any folder and the
merge works. Phew, that wasn't all that easy.

Thanks for all the help from all.

LAR

"macropod" wrote:

Hi Peter,

Surprising indeed! And the code works equally well with '/../' instead of '\\..\\'.

I've done a bit of experimenting with the technique you described and find that it works with INCLUDETEXT, RD & HYPERLINK fields,
but not with LINK fields..

The same approach can be extended to implement true relative addressing. For example:
{INCLUDEPICTURE "{FILENAME \p}\\..\\My Pictures\\AdobeRGB.png"}
looks in the current file's child folder named 'My Pictures' and:
{INCLUDEPICTURE "{FILENAME \p}\\..\\AdobeRGB.png"}
looks in the current file's parent folder, while:
{INCLUDEPICTURE "{FILENAME \p}\\..\\..\\My Pictures\\AdobeRGB.png"}
looks in the current file's parent folder, then the parent's child folder named 'My Pictures' (I guess you could call that a sibling
folder).

Cheers


--
macropod
[MVP - Microsoft Word]


"Peter Jamieson" <pjj@xxxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:Ol2dEffRHHA.3592@xxxxxxxxxxxxxxxxxxxxxxx
| Hi macropod,
|
| I've constucted paths using { filename \p } before, e.g. where you have
|
| folderx
| docy.doc
| docy.doc.folder
| docz.doc
|
| and use
|
| "{ filename \p }.folder\\docz.doc" to reference the .doc
|
| but I don't think I've ever actually tried the \\..\\ thing before and am
| quite surprised that it creates a legit. pathname.
|
| Because there's mixture of single backslashes and doubled backslashes in the
| constructed path name so it's a bit surprising that it works at all,
| anywhere, but then that's often the way with fields :-)
|
| Peter Jamieson
|
| "macropod" <invalid@xxxxxxxxxxxxxxx> wrote in message
| news:52dhcrF1no6ptU1@xxxxxxxxxxxxxxxxxxxxx
| > Hi Peter,
| >
| > That works too. Neat trick!
| >
| > Cheers
| >
| > --
| > macropod
| > [MVP - Microsoft Word]
| >
| >
| > "Peter Jamieson" <pjj@xxxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
| > news:%23hGL37aRHHA.1908@xxxxxxxxxxxxxxxxxxxxxxx
| > | Worth trying the following, just in case...
| > |
| > | { INCLUDEPICTURE "{ filename \p }\\..\\{ MERGEFIELD picname }.jpg }
| > |
| > | But
| > | a. although it appears to work here these sorts of construct make me
| > | nervous
| > | b. you may have to uncheck Word Tools|Options|General|"Web
| > | options"|Files|"Update links on save"
| > |
| > | Peter Jamieson
| > | "LAR" <LAR@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
| > | news:C5766CC2-850B-4D6E-A0E0-C8ECC17FE5D0@xxxxxxxxxxxxxxxx
| > | >I am now trying to use the INCLUDEPICTURE field to insert pictures into
| > my
| > | > mail merge document. I would like to be able to merge pictures into
| > the
| > | > document that are in the same folder as the main document. Here is
| > what I
| > | > have tried and seen.
| > | >
| > | > I have successfully merged the pictures by using the entire path to
| > the
| > | > picture using something like {INCLUDE PICTURE "C:/temp/{MERGEFIELD
| > | > picname}.jpg" \* MERGEFORMAT}. However, I want to be able to use the
| > | > "current folder" to merge the pictures from.
| > | >
| > | > I have tried {INCLUDE PICTURE "{MERGEFIELD picname}.jpg" \*
| > MERGEFORMAT}
| > | > only to find that WORD uses the DOCUMENTS path (Tools::options::file
| > | > locations::documents) as the path for the merged files. I know this
| > | > because
| > | > I have moved some of the pictures into the DOCUMENTS path folder and
| > only
| > | > the
| > | > pictures that I move there appear in the merged document.
| > | >
| > | > I tried to use a relative path with things like {INCLUDE PICTURE
| > | > "../{MERGEFIELD picname}.jpg" \* MERGEFORMAT} with no luck.
| > | >
| > | > I've looked at all the VBA examples for AutoOpen but could find
| > nothing
| > | > the
| > | > TEMPORAIRLY changed the DOCUMENTS path to that of the source (main)
| > | > document.
| > | >
| > | > So now, here I am again, asking how to accomplish what seems like a
| > simple
| > | > task (merge the pictures in the current folder into my document) that
| > I
| > | > can't
| > | > seem to figure out for myself.
| > | >
| > | > Thanks in advance for any thoughts for ideas.
| > | >
| > | > LAR
| > |
| > |
| >
| >
|
|



.



Relevant Pages

  • Re: More stupid INCLUDEPICTURE questions
    ... Surprising indeed! ... looks in the current file's child folder named 'My Pictures' and: ... | Peter Jamieson ...
    (microsoft.public.word.mailmerge.fields)
  • Re: Shellexecute a CAB File
    ... Peter Foot ... >>> You need to be very careful about spaces in folder and file names. ... >>>> slashes and used quotes and nothing worked. ... The same exact path ...
    (microsoft.public.dotnet.framework.compactframework)
  • RE: ASPNET does not have write access ... tried everything?
    ... Thanks Peter. ... Gave ASPNET and NETWORK SERVICE full. ... Just right click on the folder in Windows Explorer. ... and / or the IIS_WPG account depending on your OS. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: If I copy the files, can I import selectively?
    ... Peter, will you please stick to one of your many threads here? ... > Can I then rename the Husband identity to Wife? ... Those that are located in some other folder ... >> other than your default message store are the ones you want to import. ...
    (microsoft.public.windows.inetexplorer.ie6_outlookexpress)
  • Re: How to recover messages.
    ... "Peter" wrote in message ... I opened it with Notepad and sure enough at least some of the emails were ... "Steve Cochran" wrote: ... >> to a folder location on the same computer you wish to do the import ...
    (microsoft.public.windows.inetexplorer.ie6_outlookexpress)