Excel headaches
Excel headaches
- Subject: Excel headaches
- From: "Patrick S. Page-McCaw" <email@hidden>
- Date: Mon, 14 Oct 2002 15:27:11 -0700
Sometimes my Excel scripts work and sometimes they don't. Usually
they fail with :
"-1708 Unable to get the Select property of the ... class"
Today I get :
"-1708 Microsoft Excel cannot paste the data. "
Where the class can be one of many things. Sometimes manually
clicking on Excel and going back to the script solves the trouble,
but not always.
In this case, the error arises from selecting in the Range class. It
comes from a call to
on pasteXLData(theBook, theSheet, theRange)
tell application "Microsoft Excel"
Activate
Select Range theRange of Sheet theSheet of Workbook theBook
Paste
end tell
end pasteXLData
but, a preceding call to copyXLData(...) with the same syntax worked
just fine. The Range is a valid range, the space being pasted to is
empty etc. In fact, in a repeat loop the same handler will work the
first time through but bail (with -1708) the next run through.
I changed that handler to
on pasteXLData(theBook, theSheet, theRange)
tell application "Microsoft Excel"
Activate Workbook theBook
Select Sheet theSheet
Select Range theRange
Paste
end tell
end pasteXLData
and it worked for a few days, but now I get the "cannot paste" error.
This might make sense from the Dictionary which says that Paste wants
an object. But if that is true why is there no object when recording
the paste event. I can manually do the pasting just fine. If I
change the handler to read:
Paste Range theRange of Sheet theSheet of Workbook theBook
that also does not work.
Clearly, I don't understand Excel scripting (a confusion of
properties and verbs?). But what am I missing?
Any help greatly appreciated,
Patrick
--
___________________________________________________________________________
Patrick S. Page-McCaw
University of California, San Francisco
Department of Physiology, Box 0444
513 Parnassus Avenue, Room S-864
San Francisco, California 94143-0444
phone: 415 476-8367
fax: 415 476-4929 attn P. Page-McCaw
email: email@hidden
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.