Excel Automation Problem

  • Thread starter Thread starter Mark C
  • Start date Start date
M

Mark C

I currently have an Excel spreadsheet with numerous text boxes and check
boxes that I want to populate with data from an Access 97 database. I have
used Excel automation in Access before but only to update cells not controls
like text boxes.

Can someone steer me onto the correct path? I am not using a VBA form in
Excel it is just merely various text boxes and checkboxes placed on a
worksheet.
Any help would be much appreciated.


Regards,
Mark
 
You can use alt-F11 to display the VBE pane for your spreadsheet. There are
two dropboxes at the top of the right-hand pane - the left-most one has a
list of all the objects (including text boxes and check boxes) on your
spreadsheet. You should be able to get the names of your objects from
there.

HTH
- Turtle
 
I understand that, but how do I reference the Excel control from Access.
Normally I would write some kind of statement like
worksheet1.Range(A1).value = rst!fieldname.

If I try that with a control name I get an error. I am trying to find out
how to reference the Excel control in this line of code.

Mark
 
Sorry!
It's coming back to me slowly...
Those controls on Excel are quite difficult to reference externally.
(In fact, I think they're difficult to reference internally, too.)
The best I've done (AFICR) is to link your textbox (or checkbox) to an Excel
cell, then programmatically put the value in the cell.
If the control is big enough, you can "hide" the linked value in a cell
directly under it; otherwise you can use a separate sheet if you like.

HTH
 
Please see response in
comp.databases.ms-access

Mark C said:
I understand that, but how do I reference the Excel control from Access.
Normally I would write some kind of statement like
worksheet1.Range(A1).value = rst!fieldname.

If I try that with a control name I get an error. I am trying to find out
how to reference the Excel control in this line of code.

Mark
 
try this:
Sheet1.TextBox1.Text = rst!fieldname
you get access to a control by going threw the worksheet object
 
Sir,

Let me explain. First I have 5 combinations. If I activate one check
box the rest has to be disabled.

For eg. Checkbox1 to 5. Checkbox 1 is clicked, 2to5 has to be
disabled.

Second, If I deselect the checked check box, The disabled checkboxes
has to be active for checking along with the checked check box.

For eg. checkbox 1 to 5. Checkbox 1 which is already clicked, is not
clicked again to to removed tick mark, at that time the disabled 2 to 5
must be active.

Can anyone help me out right now.
 
It sounds as if you have five checkboxes, only one of which may be
checked at any one time. If that's the case, it seems to me that it
would be be clearer for the user, and more in compliance with Windows
user interface guidelines, to use six option buttons (radio buttons):
one for each of your existing options and the last for "None".

That way, the automatic behaviour of the option group would ensure that
only one button could be selected at a time, and your code would be much
simpler.
 
Back
Top