I findout myself with the following code:
Const wdQuote = """"
strFileName = lbxList.Value
strDirName = "L:\CCS\word\Logo\"
strDirFileName = strDirName + strFileName
strDirFileName = Replace(strDirFileName, "\", "\\")
If Len(strDirFileName) > 0 Then
ActiveDocument.Fields.Add _
Range:=Selection.Range, _
Type:=wdFieldIncludePicture, _
Text:=wdQuote & strDirFileName & wdQuote, _
preserveformatting:=False
End If
But how can i place the logo where i want? Because now it will be inserted
where the cursor is.
Thanks again for your help!
> Thxs for your response! But how can I insert a field into the document?
> Because when i insert the includepicture field as a string into the document,
[quoted text clipped - 43 lines]
> > >
> > > Many thanks in advance.
Jay Freedman - 12 Apr 2005 14:55 GMT
The first argument in the ActiveDocument.Fields.Add statement is called
"Range", and it represents the place where the field is inserted. The way
you wrote it, Range:=Selection.Range, means that the field is inserted
wherever the cursor (the Selection) is. But you can tell it to use any other
location in the document.
Just like in the article on mvps.org, put a bookmark named Logo in the
template at the location where you want the logo to appear. Then tell the
ActiveDocument.Fields.Add statement to insert the field there by using this
line instead of the one you have now:
Range:=ActiveDocument.Bookmarks("Logo").Range, _

Signature
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
> I findout myself with the following code:
>
[quoted text clipped - 72 lines]
>>>>
>>>> Many thanks in advance.