2012-03-07 56 views
0

我想使用AppleScript來查找我放在數據集旁邊的TAG單元,以便我可以在單獨的結果表中鏈接到這些值。無法在Excel 2008中使用find命令來工作

目前我所得到的是錯誤告訴我,這個,那個和其他不明白的發現。這裏的腳本:

tell application "Microsoft Excel" 
    tell active workbook 
     activate object worksheet "1001" 
     tell sheet "1001" 
      set searchRange to used range 
      tell searchRange 
       (find searchRange what "TAG") 
      end tell 
     end tell 
    end tell 
end tell 

我跟這個有完整的初學者如此徹底難倒

回答

0

下面的作品對我非常好:(這一代碼進入tell sheet "1001"end tell之間):

set searchRange to used range 
try 
    set foundRange to find searchRange what "blurp" with match case 
    (* do something with the foundRange *) 
on error -- not found 
    (* do error handling *) 
end try 

如果它發現"blurp",則返回一個範圍(類似range "'[Workbook1]1001'!$D$4" of application "Microsoft Excel"),否則會引發錯誤(僅表示找不到您搜索的內容)。

+0

謝謝,我想我沒有給它任何與它發現的範圍有關! – Priesto 2012-03-07 15:28:56