Sunday, August 20, 2017

#1 2017-04-12 07:56:04 am

beerisgood
Member
Registered: 2017-02-12
Posts: 3

Excel scripting

The following "simple" code :

set theWorkbookFile to choose file with prompt "Please select an Excel workbook file:"
set theWorkbookName to name of (info for theWorkbookFile)
tell application "Microsoft Excel"
    open theWorkbookFile
    make new workbook
    set theWorkbook to workbook theWorkbookName
    set theWorkbook to active workbook
    tell active workbook
        make new worksheet at beginning
        activate object worksheet "Sheet1"
        set value of cell "A1" to "A"
    end tell
end tell

Results in the following error:
error "Microsoft Excel got an error: The object you are trying to access does not exist" number -10006 from value of cell "A1" of active workbook

Please help


Filed under: excel

Offline

 

#2 2017-04-12 08:14:23 am

Yvan Koenig
Member
Registered: 2006-09-14
Posts: 3182

Re: Excel scripting

I never use Merdosoft products but it seems that your error is easy to find.

Applescript:

set theWorkbookFile to choose file with prompt "Please select an Excel workbook file:"
set theWorkbookName to name of (info for theWorkbookFile)
tell application "Microsoft Excel"
open theWorkbookFile
make new workbook
set theWorkbook to workbook theWorkbookName
set theWorkbook to active workbook
tell active workbook
make new worksheet at beginning
activate object worksheet "Sheet1"
tell worksheet "Sheet1" # ADDED
set value of cell "A1" to "A"
end tell # ADDED
end tell
end tell

Yvan KOENIG running Sierra 10.12.4 in French (VALLAURIS, France) mercredi 12 avril 2017 15:14:03

Offline

 

#3 2017-04-12 12:28:30 pm

t.spoon
Member
From:: BFE, Massachusetts
Registered: 2013-01-13
Posts: 199

Re: Excel scripting

I like the way "Merdosoft" works out in French better than the standard English "Micro$oft."


Hackintosh built February, 2012 |  Mac OS Sierra
GIGABYTE GA-Z68X-UD3H-B3 | Core i5 2500k | 16 GB DDR3 | GIGABYTE Geforce 1050 TI 4GB
250 GB Samsung 850 EVO | 4 TB RAID
Dell Ultrasharp U3011 | Dell Ultrasharp 2007FPb

Offline

 

#4 2017-04-12 09:05:38 pm

DJ Bazzie Wazzie
Member
From:: the Netherlands
Registered: 2004-10-20
Posts: 2683
Website

Re: Excel scripting

Microsof Office is a bargain compared to the immature/incomplete iWork bundle from Apple. iWork is nice for candy land users but is completely lost at professional level.

Offline

 

#5 2017-04-13 09:35:32 am

t.spoon
Member
From:: BFE, Massachusetts
Registered: 2013-01-13
Posts: 199

Re: Excel scripting

I do rely on Excel. Google Sheets is getting competitively extensible, but it's still not there yet.

I've barely used iWork.

But most people's problems with Microsoft are due to their business practices foremost, and their software quality second. Not with the feature set of Office.


Hackintosh built February, 2012 |  Mac OS Sierra
GIGABYTE GA-Z68X-UD3H-B3 | Core i5 2500k | 16 GB DDR3 | GIGABYTE Geforce 1050 TI 4GB
250 GB Samsung 850 EVO | 4 TB RAID
Dell Ultrasharp U3011 | Dell Ultrasharp 2007FPb

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)