簡體   English   中英

在Word宏中獲取所選圖像的文件路徑

[英]Get file path of selected image in Word macro

我有一個包含多個圖像的Word文檔。 這些圖像位於子文件夾中的硬盤驅動器上,並且已鏈接到Word文檔中。

我想選擇一個圖像並執行一個宏,然后打開一個消息框,讓我知道圖像的完整路徑。

這是為您提供的代碼:

Sub GetFullPath()

On Error Resume Next
    Dim fullPath As String
    fullPath = Selection.ShapeRange(1).LinkFormat.SourceFullName
    fullPath = Selection.InlineShapes(1).LinkFormat.SourceFullName
    MsgBox fullPath

End Sub

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM