【问题标题】:AppleScript, Microsoft Excel, and Hyperlink EnablingAppleScript、Microsoft Excel 和超链接启用
【发布时间】:2011-11-03 06:30:08
【问题描述】:

有一个关于creating active hyperlinks in Excel without resorting to a macro 的问题...但假设一个是否想要创建一个宏,或者更确切地说是AppleScript 中的某个东西?

我开始搜索 Excel for Mac 的 AppleScript 字典……到目前为止,我已经得到了这个(假设第 1 列包含一行又一行,相当于每个单元格中的一个 URI,并且没有一个被激活):

tell application "Microsoft Excel"
    activate
    make new hyperlink of column 1 at active sheet with properties {address:column 1}
end tell

这几乎可以工作......除了每个单元格最终成为http://www.microsoft.com/mac/ 的超链接! (很好的接触,MSFT。呵呵。)不过说真的,我不禁认为我离这里很近,但我不确定我错过了什么。

为了比较,这里有一个有效的 Excel 宏(使用选择)。

For Each xCell In Selection
    ActiveSheet.Hyperlinks.Add Anchor:=xCell, Address:=xCell.Formula
Next xCell

欢迎和赞赏线索!

【问题讨论】:

    标签: excel hyperlink applescript macos


    【解决方案1】:

    我相信我拥有它!假设单元格位于第 8 列(不包括标题行)。你可以这样做。

    tell application "Microsoft Excel"
        tell (get used range of active sheet)
            repeat with i from 2 to count rows
                set v to value of column 8 of row i
                make new hyperlink at column 8 of row i with properties {address:v}
            end repeat
        end tell
    end tell
    

    n.b.:我不知道这是否是“正确的”AppleScript,但我认为这是一个开始。请随时提供改进!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-10-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-07-29
      相关资源
      最近更新 更多