簡體   English   中英

使用AppleScript在Excel文件中創建超鏈接

[英]Create hyperlink in Excel file using AppleScript

在Mac上的Excel 2008中,我想在同一Excel文檔中使用AppleScript在單元格“ A8”的工作表1上創建超鏈接。

<hyperlink ref="A8" location="Sheet1!A20" display="Sheet1!A20" />

我嘗試了以下腳本,該腳本不起作用:

tell application "Microsoft Excel"
   make new workbook
   tell worksheet "Sheet1" of active workbook
       make new hyperlink of cell "A8" with properties {address :"#Sheet1!A20", text to display:"Sheet1!A20"}
   end tell
end tell

您能幫我弄清楚該怎么做嗎?

這是一個艱難的! 以下作品:

tell application "Microsoft Excel"
    tell worksheet "Sheet1" of active workbook
        make new hyperlink of cell "A8" with properties {address:"", sub address:"$A$20", text to display:"Sheet1!A20"}
    end tell
end tell

注意-我已經編輯了此答案以改善它。 在第一次嘗試中,我沒有address:""正確。 您在評論中自己指出了這一點。 這是缺少的部分-使用""作為address會創建對“此文檔”的引用。 導致問題的原因是添加#號(手動輸入超鏈接時似乎會發生這種情況)。

暫無
暫無

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

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