Hello Everyone,
Just looking for a basic AppleScript to use with Excel.
I need to Select All and then Copy to clipboard.
I could always use KM keystrokes to select cell A1, select all, copy, but I was hoping for a clean scripted way.
I am hoping to learn a little more about AppleScript and Excel.
If anyone can recommend a good training source, that would be wonderful as well.
Hey Mike,
You just want the value of cell A1? If that's not all then please be more specific.
tell application "Microsoft Excel"
tell active sheet of active workbook
set cellAOneValue to value of cell "A1"
end tell
end tell
It's a good idea to mention what data you're collecting as well, since there are a few pitfalls when dealing with certain data-types.
For what? AppleScript in general? AppleScripting Microsoft Excel?
There's not a single great source.
Run, don't walk and buy a copy of Script Debugger, or at the very least download and use the free (Lite) version instead of Apple's horribly anemic Script Editor app. (Even the Lite version of SD eats the SE's lunch.)
-Chris
Thank you, Chris.
I am looking to copy all used range. I got this much so far that works. It's the Copy that I am stuck with.
tell application "Microsoft Excel"
tell active sheet
select used range
end tell
end tell
The data is a variety of dates, names, numbers, emails.
And for the training, all of the above. A lot of my KM macros are playing with Excel files. So if I can find a clean way to go about manipulating them instead of Keystroke actions, I thought it would be best to learn how to use Applescript. Not to mention, every time I ask and you answer, you give me a scripted option as well as a macro option. SO I thought learning Applescript would be beneficial for my growth and KM experience (among using the mac to it's fullest potential).
So all that to say, thank you.
This will give you a list of lists:
tell application "Microsoft Excel"
tell active sheet of active workbook
set usedRangeValueList to value of used range
# set usedRangeFormulaList to formula of used range
end tell
end tell
Try the script as is, and if it doesn't give you the data in the format you want try uncommenting the usedRangeFormulaList line and running again.
1 Like
Another AS/Excel question..
Is there a way to check a checkbox with KM (That is not in a web browser)? Say... Excel... Without using images.
Actually just found this Check box in dialog box - #9 by JMichaelTX
I think it works!
1 Like