codingguy3000
codingguy3000

Reputation: 2835

In AppleScript how to you retrieve the name of the current active worksheet?

It seems like a simple question, but much use of Google has not yielded the answer.

Consider the following code...

tell application "Microsoft Excel"
    set strActiveWorkSheet to active sheet of active workbook

    display dialog strActiveWorkSheet
end tell

This code does not work. It seems that the set command is setting strActiveWorkSheet to a object that represents the Active Worksheet.

Maybe I'm on the wrong track here but the questions remains...

How to I retrieve the name of the current active Excel worksheet?

Upvotes: 0

Views: 1344

Answers (1)

regulus6633
regulus6633

Reputation: 19032

Funny... your question is the answer... just get its name. You're right. You have an object the way its written and the object has properties, one of which is "name". In other words change this line...

set strActiveWorkSheet to name of active sheet of active workbook

To see all of the properties of the object try this...

tell application "Microsoft Excel"
    return properties of active sheet of active workbook
end tell

You can access any of those properties just by asking for it. Good luck.

Upvotes: 1

Related Questions