ControlSource Compatibility VBA - VB6

J

John M

Hello and Help:

I wrote VBA code (Excel 2000 SR1) which connected UserForms with
textboxes to worksheet cells. In a moment of insanity, I decided to
also convert this to VB6. Now, after successfully “getting” an existing
Excel Workbook, the ControlSource property is problematic – except
possibly for those cells which were originally null. The Error
encountered is that “Could not set the ControlSource property. Invalid
property value.” Do I need a different syntax for referring to a
Worksheet Cell? There are no spaces or other “unacceptable” characters
in the sheet name. Am I inheriting a restriction? These are UserForms
in the Designer Folder of vb6. They are not VB6 Forms.

As an example:

frmInputCompletion.txtWHwrtRT.ControlSource = xlSheet.Range("C3")

gives an error.

Any help would be greatly appreciated.

Sincerely

John M.




*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
 
K

keepitcool

John,


rowsource/controlsource need a string, so you'd have to give the range's
address. to be safe i'd advise you to give it a fully qualified adress.

assuming xlsheet is a worksheet variable..
==> xlsheet.Range("c3").address(external:=true)

keepITcool

< email : keepitcool chello nl (with @ and .) >
< homepage: http://members.chello.nl/keepitcool >
 
J

John M

Dear keepITcool:
Thanks for the advice. I tried this and I am still receiving the same
error. I can see that it is pointing to the correct worksheet cell. It
seems more insidious! As I try it now, I am even having trouble with
these UserForms in design view in the VB6 DE. If you have any other
suggestions, they would be appreciated.

John M.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top