Discussion:
Excel and Office 2007
(too old to reply)
Rod Caldwell
2008-11-01 06:03:44 UTC
Permalink
I've just updated to Office 2007 and now my Reports option to Excel does not work (a generic code copied from the knowledge base).

I've isolated the problem to the paste function. This could either be with the past function itself or the clipboard.cc not uploading data in the correct format (XP SP1). I have the lastest version of Clipborad.cc.

Is anyone else having this problem?

function EXCELBTN_onClick
local oExcel, i, nRow, f
_app.l = true // Excel

// Create instances of our variables so we can use
// the assignment (:=) operator from here on out.
store 0 to oExcel, i, nRow

cText = "" // initialize our string variable

if form.OUTSTANDING.value = true
Class::OUTSTANDINGwk(False) // load cText with the information required
else // form.ALLOUTSTANDING.value = true
Class::OUTSTANDINGwk(True)
endif

set procedure to clipbord.cc additive
_app.Clip = new TextClipboard() // create our clipboard object

_app.Clip.SetClipboardText( cText ) // place our string

// now we start Excel
oExcel := new oleAutoclient("excel.application")

// create a new workbook
oExcel.workbooks.add()

// since the field and record separators are embedded
// all we need to do is select the top left cell.
// of course you could stick column headings in here,
// but we won't bother in this example.
oExcel.ActiveSheet.cells( 1,1 ).select()

// now just call Excel's paste method
oExcel.ActiveSheet.paste() // FAILS AT THIS POINT

// and size the columns to fit
oExcel.ActiveSheet.Columns.AutoFit()

// now we select A1 to un-select the range
oExcel.ActiveSheet.Range("A1").Select()

// and proudly show the result
oExcel.visible = true

form.close()

return
Geoff Wass [dBVIPS]
2008-11-02 07:01:08 UTC
Permalink
In article <s7QxYe#***@news-server>, ***@tpabusiness.com.au
says...
Post by Rod Caldwell
I've just updated to Office 2007 and now my Reports option to Excel does not work (a generic code copied from the knowledge base).
I've isolated the problem to the paste function. This could either be with the past function itself or the clipboard.cc not uploading data in the correct format (XP SP1). I have the lastest version of Clipborad.cc.
Is anyone else having this problem?
Rod,

When you say it doesn't work, what exactly does that mean? Do you get
error messages? If so, what are they? If not, does it do anything? If
so, what?
--
Geoff Wass [dBVIPS]
Montréal, Québec, Canada

.|.|.| dBASE info at http://geocities.com/geoff_wass |.|.|.
.|.|.| ---------------------------------------------------------- |.|.|.
.|.|.| IT Consultant http://Geoff_Wass.com |.|.|.
Rod Caldwell
2008-11-02 09:06:11 UTC
Permalink
Hi Geoff

Error: OLE Dispatch Exception: Unable to get the Paste property of the Worksheet class

Cheers
Rod
Post by Geoff Wass [dBVIPS]
says...
Post by Rod Caldwell
I've just updated to Office 2007 and now my Reports option to Excel does not work (a generic code copied from the knowledge base).
I've isolated the problem to the paste function. This could either be with the past function itself or the clipboard.cc not uploading data in the correct format (XP SP1). I have the lastest version of Clipborad.cc.
Is anyone else having this problem?
Rod,
When you say it doesn't work, what exactly does that mean? Do you get
error messages? If so, what are they? If not, does it do anything? If
so, what?
--
Geoff Wass [dBVIPS]
Montréal, Québec, Canada
.|.|.| dBASE info at http://geocities.com/geoff_wass |.|.|.
.|.|.| ---------------------------------------------------------- |.|.|.
.|.|.| IT Consultant http://Geoff_Wass.com |.|.|.
Geoff Wass [dBVIPS]
2008-11-03 05:58:55 UTC
Permalink
In article <***@news-server>, ***@tpabusiness.com.au
says...
Post by Rod Caldwell
Hi Geoff
Error: OLE Dispatch Exception: Unable to get the Paste property of the Worksheet class
Cheers
Rod
Rod,

Perhaps the function has been moved between versions of Word? (Just a
wild guess). Do you have any Word documentation for that object?
--
Geoff Wass [dBVIPS]
Montréal, Québec, Canada

.|.|.| dBASE info at http://geocities.com/geoff_wass |.|.|.
.|.|.| ---------------------------------------------------------- |.|.|.
.|.|.| IT Consultant http://Geoff_Wass.com |.|.|.
Rod Caldwell
2008-11-03 11:24:01 UTC
Permalink
Hi Geoff,

My guess is that the syntax for the paste function in Office 2007 has changed but I do not know where to look to double check that. I copied the code 'as is' from the knowledge base article on EXCEL.

Cheers
Rod
Post by Geoff Wass [dBVIPS]
says...
Post by Rod Caldwell
Hi Geoff
Error: OLE Dispatch Exception: Unable to get the Paste property of the Worksheet class
Cheers
Rod
Rod,
Perhaps the function has been moved between versions of Word? (Just a
wild guess). Do you have any Word documentation for that object?
--
Geoff Wass [dBVIPS]
Montréal, Québec, Canada
.|.|.| dBASE info at http://geocities.com/geoff_wass |.|.|.
.|.|.| ---------------------------------------------------------- |.|.|.
.|.|.| IT Consultant http://Geoff_Wass.com |.|.|.
Geoff Wass [dBVIPS]
2008-11-04 06:25:11 UTC
Permalink
In article <***@news-server>, ***@tpabusiness.com.au
says...
Post by Rod Caldwell
Hi Geoff,
My guess is that the syntax for the paste function in Office 2007 has changed but I do not know where to look to double check that. I copied the code 'as is' from the knowledge base article on EXCEL.
Cheers
Rod
Rod,

If we are talking about the same article, you will have to follow the
article's suggestion to use the Excel macro to see how it would make the
VB script code (or whatever they call the Excel macro language) and
reconstruct that in dBASE code.
--
Geoff Wass [dBVIPS]
Montréal, Québec, Canada

.|.|.| dBASE info at http://geocities.com/geoff_wass |.|.|.
.|.|.| ---------------------------------------------------------- |.|.|.
.|.|.| IT Consultant http://Geoff_Wass.com |.|.|.
Roland Wingerter
2008-11-02 12:26:05 UTC
Permalink
Post by Rod Caldwell
I've just updated to Office 2007 and now my Reports option to Excel does
not work (a generic code copied from the knowledge base).
-------
Are you using a regular version of Office2007 or a Trial version? I am
asking because I had problems with a trial version which did not appear in
the regular version.

Roland
Rod Caldwell
2008-11-03 00:17:58 UTC
Permalink
Hi Roland

I'm using the full legitimate version provided by my employer (a College) under the Microsoft licence. Some of my clients (Colleges) also using full legitimate versions are also having troubles.

Microsoft Office Excel 2007 (12.0.6324.5001) SP1 MSO (12.0.6320.5000)

Cheers
Rod
Post by Geoff Wass [dBVIPS]
Post by Rod Caldwell
I've just updated to Office 2007 and now my Reports option to Excel does
not work (a generic code copied from the knowledge base).
-------
Are you using a regular version of Office2007 or a Trial version? I am
asking because I had problems with a trial version which did not appear in
the regular version.
Roland
*Lysander*
2008-11-03 06:40:24 UTC
Permalink
Post by Rod Caldwell
Microsoft Office Excel 2007 (12.0.6324.5001) SP1 MSO (12.0.6320.5000)
Rod,
Office 2007 sometimes behaves shrewd when you want to paste something
while you selected a cell (for writing...).

Instead of "SELECT"ing the cell (1,1), try either to select the "Range"
A1 (as you did further down your code) or better even try to not select
anything before you do the paste.
Rod Caldwell
2008-11-03 11:20:59 UTC
Permalink
Thanks for the suggestion, but I tried both and still the same error message persists. I've also tried to cut down the cText to just one word "TEST" but the paste error still persists.

I've been using the routine that I pasted directly from the knowledge base article on Excel for about 2 years with only a few minor problems until I loaded Office 2007.

Can anyone double check the 2007 Paste properties or tell me where I can find the syntax?

Cheers
Rod
Post by *Lysander*
Post by Rod Caldwell
Microsoft Office Excel 2007 (12.0.6324.5001) SP1 MSO (12.0.6320.5000)
Rod,
Office 2007 sometimes behaves shrewd when you want to paste something
while you selected a cell (for writing...).
Instead of "SELECT"ing the cell (1,1), try either to select the "Range"
A1 (as you did further down your code) or better even try to not select
anything before you do the paste.
Lysander
2008-11-03 12:14:03 UTC
Permalink
Post by Rod Caldwell
Can anyone double check the 2007 Paste properties or tell me where I can find the syntax?
Works for me, but I am using C# for automation, not dBase.

You could look here:
http://msdn.microsoft.com/en-us/library/bb179200.aspx


are you sure that all steps _BEFORE_ the paste() are working correctly,
e.g. there definitely _IS_ an ActiveSheet and you definitely selected a
RANGE (not a Cell)?
Loading...