Discussion:
EXCEL and Office 2007 - Success!
(too old to reply)
Rod Caldwell
2008-11-03 12:07:40 UTC
Permalink
Hi all,

I\'ve found the bug I was describing earlier where the PASTE function in Excel refused to work. You must open Excel first before you load the data into the clipboard!

The modified code is :

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) // loads to text into cText
else // form.ALLOUTSTANDING.value = true
Class::OUTSTANDINGwk(True)
endif

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

oExcel.visible = true

// 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 add the text into the clipboard
// THIS MUST BE DONE AFTER YOU OPEN EXCEL
set procedure to clipbord.cc additive
_app.Clip = new TextClipboard() // create our clipboard object

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

// now just call Excel's paste method
oExcel.ActiveSheet.paste()

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

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

form.close()

return
Lysander
2008-11-03 12:17:51 UTC
Permalink
Post by Rod Caldwell
Hi all,
I\'ve found the bug I was describing earlier where the PASTE function in Excel refused to work. You must open Excel first before you load the data into the clipboard!
Okay, that went together with my last post... :)
But if what you found out is true, then this is very weird.

Why should Excel be ignoring or even clearing the Clipboard on start?

The Clipboard is something completely independent of whether an excel
instance is started or not.

I suppose the "TextClipboard" class is something that uses the built-in
windows clipboard by means of the Win API?
Ken Mayer [dBVIPS]
2008-11-03 13:27:56 UTC
Permalink
Post by Lysander
Post by Rod Caldwell
Hi all,
I\'ve found the bug I was describing earlier where the PASTE function
in Excel refused to work. You must open Excel first before you load
the data into the clipboard!
Okay, that went together with my last post... :)
But if what you found out is true, then this is very weird.
Why should Excel be ignoring or even clearing the Clipboard on start?
The Clipboard is something completely independent of whether an excel
instance is started or not.
I suppose the "TextClipboard" class is something that uses the built-in
windows clipboard by means of the Win API?
That is odd, unless somehow Excel is assuming the Office Clipboard in
this case? If that's true, then it makes sense, because without any
Office programs open, then the Office Clipboard would not be available.

Ken
--
/(Opinions expressed are purely my own, not those of dataBased
Intelligence, Inc.)/

*Ken Mayer* [dBVIPS]
/Golden Stag Productions/
dBASE at goldenstag dot net
http://www.goldenstag.net/GSP
http://www.goldenstag.net/dbase/dBASEBooks.htm
http://www.goldenstag.net/dbase
Rod Caldwell
2008-11-03 22:14:41 UTC
Permalink
Hi Ken,

Yes, the behaviour is strange, but you can proove it. Open any document and do a CTRL C copy of one word. Open Excel and do a CTRL V paste - nothing. With Excel 2007 open do the same Ctrl C / CTRL V and it will work, or rather that's how it works with my copy.

Very strange indeed.

Cheers
Rod
Post by Ken Mayer [dBVIPS]
Post by Lysander
Post by Rod Caldwell
Hi all,
I\'ve found the bug I was describing earlier where the PASTE function
in Excel refused to work. You must open Excel first before you load
the data into the clipboard!
Okay, that went together with my last post... :)
But if what you found out is true, then this is very weird.
Why should Excel be ignoring or even clearing the Clipboard on start?
The Clipboard is something completely independent of whether an excel
instance is started or not.
I suppose the "TextClipboard" class is something that uses the built-in
windows clipboard by means of the Win API?
That is odd, unless somehow Excel is assuming the Office Clipboard in
this case? If that's true, then it makes sense, because without any
Office programs open, then the Office Clipboard would not be available.
Ken
--
/(Opinions expressed are purely my own, not those of dataBased
Intelligence, Inc.)/
*Ken Mayer* [dBVIPS]
/Golden Stag Productions/
dBASE at goldenstag dot net
http://www.goldenstag.net/GSP
http://www.goldenstag.net/dbase/dBASEBooks.htm
http://www.goldenstag.net/dbase
Ken Mayer [dBVIPS]
2008-11-03 22:49:19 UTC
Permalink
Post by Rod Caldwell
Hi Ken,
Yes, the behaviour is strange, but you can proove it. Open any document and do a CTRL C copy of one word. Open Excel and do a CTRL V paste - nothing. With Excel 2007 open do the same Ctrl C / CTRL V and it will work, or rather that's how it works with my copy.
Very strange indeed.
I'm not doubting you, just finding it odd that Microsoft would clear the
clipboard like that.

Ken
--
/(Opinions expressed are purely my own, not those of dataBased
Intelligence, Inc.)/

*Ken Mayer* [dBVIPS]
/Golden Stag Productions/
dBASE at goldenstag dot net
http://www.goldenstag.net/GSP
http://www.goldenstag.net/dbase/dBASEBooks.htm
http://www.goldenstag.net/dbase
Lysander
2008-11-04 09:24:42 UTC
Permalink
Post by Ken Mayer [dBVIPS]
Post by Rod Caldwell
Hi Ken,
Yes, the behaviour is strange, but you can proove it. Open any
document and do a CTRL C copy of one word. Open Excel and do a CTRL V
paste - nothing. With Excel 2007 open do the same Ctrl C / CTRL V and
it will work, or rather that's how it works with my copy.
Very strange indeed.
I'm not doubting you, just finding it odd that Microsoft would clear the
clipboard like that.
I just tried that with Office2000 on Win2000 (my "development" machine).
You can copy something, then start excel, and than paste it. That's what
I would expect.

Later that day I will boot XP/SP3 and Vista both with Office 2007 and
try again.
Lysander
2008-11-04 14:14:35 UTC
Permalink
Post by Lysander
I just tried that with Office2000 on Win2000 (my "development" machine).
You can copy something, then start excel, and than paste it. That's what
I would expect.
Later that day I will boot XP/SP3 and Vista both with Office 2007 and
try again.
negative. I copied some text, then opened Excel for the first time since
starting the system, then pasted the content of the clipboard. Success.


In addition I tried to find any setting in Excel2007 which would
probably block or avoid that, but failed.

So there obviously is nothing that you can do to disturb the copy/paste
function from working properly.


Question: in the case of the problematic system.... do you probably have
any 3rd party clipboard manager installed? There are some available for
Office which will allow for example to put 6 different objects into the
clipboard and when pasting select 1 of the 6.

Such software is "undoubtedly" useful, but it also has a potential of
breaking otherwise proper systems.
Bruce Beacham
2008-11-04 21:17:03 UTC
Permalink
Post by Rod Caldwell
Yes, the behaviour is strange, but you can proove it. Open any
document and do a CTRL C copy of one word. Open Excel and do a CTRL
V paste - nothing. With Excel 2007 open do the same Ctrl C / CTRL V
and it will work, or rather that's how it works with my copy.
I get it to work OK in Excel 2003, XP SP3.

Might your version of Windows (and Office) not be fully patched?


Bruce Beacham
Rod Caldwell
2008-11-06 06:52:28 UTC
Permalink
Hi Bruce,

Yes mine works with Office 2003 but it failed when I upgraded to Office 2007. (My version of XP is fully patched)

Cheers
Rod
Post by Bruce Beacham
Post by Rod Caldwell
Yes, the behaviour is strange, but you can proove it. Open any
document and do a CTRL C copy of one word. Open Excel and do a CTRL
V paste - nothing. With Excel 2007 open do the same Ctrl C / CTRL V
and it will work, or rather that\'s how it works with my copy.
I get it to work OK in Excel 2003, XP SP3.
Might your version of Windows (and Office) not be fully patched?
Bruce Beacham
Robert Bravery
2008-11-03 19:32:41 UTC
Permalink
HI Rod,

As a side note. Office uses the open document format now. SO any office
document can be read and written to without the need to have office
installed. All office documents are just XML ziped files.
Try it. Take aby office 2007 document, rename the extension to zip. Open it
up and browse the xml files. You can wrtite to it aswell. SO to write and
create an excel workbook, without using office, just create correct xml
files, put it into a xip file, and rename it to xlsx.
THe open format documentation can be found on MS site
Robert
Post by Rod Caldwell
Hi all,
I\'ve found the bug I was describing earlier where the PASTE function in
Excel refused to work. You must open Excel first before you load the data
into the clipboard!
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) // loads to text into cText
else // form.ALLOUTSTANDING.value = true
Class::OUTSTANDINGwk(True)
endif
// now we start Excel
oExcel := new oleAutoclient("excel.application")
oExcel.visible = true
// 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 add the text into the clipboard
// THIS MUST BE DONE AFTER YOU OPEN EXCEL
set procedure to clipbord.cc additive
_app.Clip = new TextClipboard() // create our clipboard object
_app.Clip.SetClipboardText( cText ) // place our string
// now just call Excel's paste method
oExcel.ActiveSheet.paste()
// and size the columns to fit
oExcel.ActiveSheet.Columns.AutoFit()
// now we select A1 to un-select the range
oExcel.ActiveSheet.Range("A1").Select()
form.close()
return
---
avast! Antivirus: Inbound message clean.
Virus Database (VPS): 081103-0, 03/11/2008
Tested on: 03/11/2008 09:28:04 PM
avast! - copyright (c) 1988-2008 ALWIL Software.
http://www.avast.com
--
Web Development, Hosting, Design and Content Management Systems
http://www.integralwebsolutions.co.za



---
avast! Antivirus: Outbound message clean.
Virus Database (VPS): 081103-0, 03/11/2008
Tested on: 03/11/2008 09:32:42 PM
avast! - copyright (c) 1988-2008 ALWIL Software.
http://www.avast.com
Loading...