On Wed, February 2, 2011 5:30 am, Alan Bourke wrote:
> I use the Office 2007 Connectivity Pack which will work with XLS and
> XLSX.
>
>
> http://www.microsoft.com/downloads/details.aspx?FamilyId=6F4EDEED-D83F-4C
> 31-AE67-458AE365D420&displaylang=en
While I appreciate the reply, this isn't going to work for me. Our legacy
code gets the range in an object, and then is copied to the clipboard
basically for later purposes. Here's a snippet of our code:
* THIS IS THE HIGHER LEVEL CALL THAT GOES BAD--THIS LINE BELOW SHOULD
RETURN AN OBJECT (THE RANGE) BUT DOES NOT. YOU CAN SEE WE WANT TO USE
THE .COPY TO GET VALUES TO/FROM THE CLIPBOARD:
oRange = This.GetRangeFromName(m.Address1)
IF ISNULL(m.oRange)
RangeValues = NULL
ELSE
OldClipText = _ClipText
oRange.Copy()
RangeValues = _ClipText
_ClipText = m.OldClipText
ENDIF
RETURN m.RangeValues
And here's the GetRangeFromName routine is where the actual problem lies:
LPARAMETERS ExcelObjectName
LOCAL oErr AS Exception, RetVal AS Boolean
TRY
*** I NEED TO FIGURE OUT HOW TO GET THE RANGE OBJECT BACK IN THE RETVAL
VARIABLE. THIS NEXT LINE ERRORS WITH THE UNKNOWN COM STATUS CODE. ***
RetVal = This.oActiveWorkBook.Names(m.ExcelObjectName).RefersToRange
** I TRIED THIS ALSO BUT IT DIDN'T WORK:
RetVal =
This.oActiveWorkBook.Sheets(this.oActiveWOrkbook.ActiveSheet.Name).Range(m.ExcelObjectName)
CATCH TO oErr
SET STEP ON
This.Message = oErr.Message
RetVal = NULL
ENDTRY
RETURN m.RetVal
So I basically need to rewrite the way that I get a Range object back from
Excel 2007. Like I said--this worked FINE in Excel 2003. ARGH!!!!!
Many Thanks if you can help,
--Mike
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message:
http://leafe.com/archives/byMID/profox/[email protected]
** All postings, unless explicitly stated otherwise, are the opinions of the
author, and do not constitute legal or medical advice. This statement is added
to the messages for those lawyers who are too stupid to see the obvious.