If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Excel > SETting a Range object

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-14-06, 11:16
Sam Landy Sam Landy is offline
Registered User
 
Join Date: May 2004
Location: New York State
Posts: 931
SETting a Range object

I need to be able to set a Range object. In my VBA, I'm selecting Range("B2"). Now I need to set a new Range object, called Rng, to the range. Every time I try to set it, though, I get the value of the range, not a range object, even though Rng is DIMmed as a Range.

If I change Rng to an Object, and try the statement Set Rng = CreateObject("Excel.Range"), I get the error "ActiveX component can't create object." If I use Set Rng = CreateObject("Excel.Application"), however, it does work.

When I look in my Object Browser, I only find CreateObject in the VBA.Interaction class, nowhere else.

How do I do this?

Thanks,

Sam

Last edited by Sam Landy; 06-14-06 at 12:02.
Reply With Quote
  #2 (permalink)  
Old 06-14-06, 13:17
norie norie is offline
Registered User
 
Join Date: Mar 2006
Posts: 163
Sam

Where are you doing this from?

Can you post what code you have so far?
Reply With Quote
  #3 (permalink)  
Old 06-14-06, 15:26
Sam Landy Sam Landy is offline
Registered User
 
Join Date: May 2004
Location: New York State
Posts: 931
Thanks for taking the time to reply. I was in crunch mode, so I changed Rng to a string and used it that way. The Range object was something I was experimenting with, and I guess I still haven't perfected it. Oh, well. There's always next time.

Thanks again.

Sam
Reply With Quote
  #4 (permalink)  
Old 06-14-06, 15:40
norie norie is offline
Registered User
 
Join Date: Mar 2006
Posts: 163
Sam

Glad you got it to work.

Perhaps if you posted the code we could point out where you are going wrong with the range object.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On