View Single Post
 
Old 04-26-2023, 04:33 AM
ChrisGreaves ChrisGreaves is offline Windows 10 Office 97-2003
Novice
 
Join Date: Nov 2022
Location: Bonavista, Newfoundland
Posts: 22
ChrisGreaves is on a distinguished road
Default Word Fields and Relative Paths to External Files - IncludePicture field problems

I am trying to implement a technique proposed by Macropod in the topic Word Fields and Relative Paths to External Files.
I can see the result of the {Filename \P} and have tried both the "/../" and the "\\.." methods. As far as I can see both methods work for the end-user (me!) until i try yo access the {IncludePicture} field in VBA.


Four macros provide access to images, here is one:-
Code:
Sub ShowImageToUser()
        Dim fld As Field
    If Selection.Fields.Count = 0 Then
'        MsgBox "EditImage - You need to select an IncludePicture field!"
        Set fld = ActiveDocument.Fields(1)
    Else
        Set fld = Selection.Fields(1)
    End If
        Dim strFullname As String
        strFullname = fld.Code.Text
        Call UW.strsplitat(strFullname, """")
        strFullname = UW.strsplitat(strFullname, """")
        ActiveDocument.FollowHyperlink Address:="file:" & strFullname
 End Sub


My macro fails on the last line, and the debug window shows this (attached image)


Thanks for any help
Chris




Attached Images
File Type: png ShowImageToUser.png (27.8 KB, 24 views)
Reply With Quote