Re: AS and Excel
Re: AS and Excel
- Subject: Re: AS and Excel
- From: "koenig.yvan" <email@hidden>
- Date: Tue, 20 Aug 2013 18:11:17 +0200
Le 20/08/2013 à 15:24, Thomas Fischer < email@hidden> a écrit : Hello Yvan,
I don't have a complete solution, but probably others can help. I found two problems: 1. Microsoft Excel seems to like to get the name of the workbook as string 2. I found no way to get anything like every cell in range ("A1:A100") whose value is not "" to work with Excel. Up to now I have:
tell application "Microsoft Excel" set testFile to choose file "PLease select the Excel Workbook!" set fileName to testFile as string set newWorkbook to open workbook workbook file name fileName set theSheet to sheet 1 set theResult to {} set theCells to (every cell in range ("A1:A100")) repeat with theCell in theCells if the value of theCell ≠ "" then copy the the value of theCell to the end of theResult end repeat theResult end tell
Best Thomas
I assume that it would be OK with :
set testFile to choose file "PLease select the Excel Workbook!"tell application "Microsoft Excel" set fileName to testFile as string set newWorkbook to open workbook workbook file name fileName set theSheet to sheet 1 set theResult to (value of every cell in range ("A1:A" & last row)) end tell
What's the need for set theSheet to sheet 1
If I missed nothing the variable theSheet is defined but isn't used.
Continuing to search on the net I found :
Excel 2004 AppleScript Reference but was unable to copy the link.
It seems that :
set testFile to choose file "PLease select the Excel Workbook!" set fileName to testFile as stringtell application "Microsoft Excel" set newWorkbook to open workbook workbook file name fileName set theSheet to sheet 1 of newWorkbook set theResult to (value of range ("A:A") of theSheet) end tell
may do the trick.
Assuming that the cell B1 is empty, what upon : set testFile to choose file "PLease select the Excel Workbook!" set fileName to testFile as stringtell application "Microsoft Excel" set newWorkbook to open workbook workbook file name fileName set theSheet to sheet 1 of newWorkbook tell theSheet set theRange to (column difference range ("A:A") comparison range "B1") end tell set theResult to (value of theRange)end tell
KOENIG Yvan (VALLAURIS, France) mardi 20 août 2013 18:11:11
|
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden