The value become wrong when get value byusing AppleScript while other worksheet is active.

M

Matthew_Minami

Version: 2008
Operating System: Mac OS X 10.5 (Leopard)
Processor: Intel

I just want to send a bug report.

Summary:
The value become wrong when get value by using AppleScript while other worksheet is active.

Description:
1. Create an AppleScript file with below script.
tell application "Microsoft Excel"
activate
set OriginalWorkbook to workbook "Workbook1"
set OriginalData to string value of column 1 of row 1 of worksheet 1 of OriginalWorkbook
end tell
2. Launch Excel 2008 and create a Workbook called "Workbook1".
3. Enter time data "11:23 PM" into A1 cell and then committed.
4. Create another workbook called "Workbook2".
5. Execute the AppleScript that created in step 1 while "Workbook2" is active.

Result>>0.97305556 set to OriginalData instead of 11:23 PM. Seems like the cell format not applied correctly from Workbook1.
Expected>>11:23 PM should be set to OriginalData.
 
C

CyberTaz

I can't tell you how to correct your script - I'm not a writer of such - but
dates & times in Excel are actually numerical values. How they display in
the cell is determined by the formatting applied to the cell. Your script is
importing the value but I see nothing that formats the cell for Time. IOW,
the time value is what's being entered into the cell on the second sheet as
though it were typed in that manner, not being imported as "11.23 PM".

HTH |:>)
Bob Jones
[MVP] Office:Mac
 
B

Bob Greenblatt

Version: 2008
Operating System: Mac OS X 10.5 (Leopard)
Processor: Intel

I just want to send a bug report.

Summary:
The value become wrong when get value by using AppleScript while other
worksheet is active.

Description:
1. Create an AppleScript file with below script.
tell application "Microsoft Excel"
activate
set OriginalWorkbook to workbook "Workbook1"
set OriginalData to string value of column 1 of row 1 of worksheet 1 of
OriginalWorkbook
end tell
2. Launch Excel 2008 and create a Workbook called "Workbook1".
3. Enter time data "11:23 PM" into A1 cell and then committed.
4. Create another workbook called "Workbook2".
5. Execute the AppleScript that created in step 1 while "Workbook2" is active.

Result>>0.97305556 set to OriginalData instead of 11:23 PM. Seems like the
cell format not applied correctly from Workbook1.
Expected>>11:23 PM should be set to OriginalData.
Looks to me like things are working fine. .973.... IS 11:23PM. You need to
get the text of the cell, not the cell's value.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top