J
Jose Valdes
In Word 2003, I'd like my VBA code to create an IncludePicture field that
contains a field called "DOCPROPERTY home_directory" as part of the path to
the external graphic file.
Current line of code: Selection.InlineShapes.AddPicture fileName:=
"c:\Directory\file_name.jpg", LinkToFile:=True, SaveWithDocument:=False
Current result: { INCLUDEPICTURE "c:\\Directory\file_name.jpg" \*
MERGEFORMAT \d }
Desired result: { INCLUDEPICTURE "{ DOCPROPERTY
home_directory }\file_name.jpg" \* MERGEFORMAT \d }
Plan A that I am considering: allow the VBA code to create the link and do a
find/replace to change "c:\\Directory\file_name.jpg" to { DOCPROPERTY
home_directory }.
Plan B: find a DocProperty collection, assign home_directory to a variable,
and use variable in the AddPicture command.
Should I use Plan A or B? Or another plan? I know how to do A, but it seems
like the long way of solving the problem. I don't know whether plan B is
possible, but (if possible) it would require fewer lines of code. Any
thoughts?
contains a field called "DOCPROPERTY home_directory" as part of the path to
the external graphic file.
Current line of code: Selection.InlineShapes.AddPicture fileName:=
"c:\Directory\file_name.jpg", LinkToFile:=True, SaveWithDocument:=False
Current result: { INCLUDEPICTURE "c:\\Directory\file_name.jpg" \*
MERGEFORMAT \d }
Desired result: { INCLUDEPICTURE "{ DOCPROPERTY
home_directory }\file_name.jpg" \* MERGEFORMAT \d }
Plan A that I am considering: allow the VBA code to create the link and do a
find/replace to change "c:\\Directory\file_name.jpg" to { DOCPROPERTY
home_directory }.
Plan B: find a DocProperty collection, assign home_directory to a variable,
and use variable in the AddPicture command.
Should I use Plan A or B? Or another plan? I know how to do A, but it seems
like the long way of solving the problem. I don't know whether plan B is
possible, but (if possible) it would require fewer lines of code. Any
thoughts?