What's the value of m.address1? The name of the range or the actual cell refs?

--
rk


-----Original Message-----
From: [email protected] [mailto:[email protected]] On 
Behalf Of MB Software Solutions General Account
Sent: Wednesday, February 02, 2011 10:02 AM
To: [email protected]
Subject: Re: Excel 2007 automation problem (VFP9SP1)

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




[excessive quoting removed by server]

_______________________________________________
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/DF1EEF11E586A64FB54A97F22A8BD0441922055142@ACKBWDDQH1.artfact.local
** 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.

Reply via email to