如何使用applescript将列内容从一个Excel文档传输到另一个Excel文档

时间:2013-10-22 11:57:54

标签: excel automation applescript applescript-excel

我有两个excel文档,一个是模板,我想使用applescript将内容从一个excel文档复制到temple excel文档。

文件1 A B C
D E F

文件2

我必须将内容从文件1转移到文件2.

提前致谢。

1 个答案:

答案 0 :(得分:0)

尝试:

tell application "Microsoft Excel"
    set myData to value of range "A1:C3" of worksheet "Sheet1" of workbook "Workbook1"
    set value of range "A1:C3" of worksheet "Sheet1" of workbook "Workbook2" to myData
end tell

修改

tell application "Microsoft Excel"
    set targetRange to "A1:C3"
    set sourceRange to range targetRange of worksheet "Sheet1" of workbook "Workbook1"
    set destRange to range targetRange of worksheet "Sheet1" of workbook "Workbook2"
    copy range sourceRange destination destRange
end tell