ActiveX in VBA

XFan

Registered User.
Local time
Today, 04:32
Joined
Jul 23, 2014
Messages
14
Hi folks,

Having some troubles with ActiveX controls. I tried with many of them as the "Spreadsheet" or the "Listview".. I add them to a form, go into VBA on a "form_load()" sub and try to use them. Problem is when I type their name and then use the "." to get their properties, I don't have properties related to the "class".
For example, for a spreadsheet, I should have stuff like "Cells" or "Columns", etc.. But nop, nothing that looks like that. What am I doing wrong? I used those ActiveX controls alot in Excel and never had any problems but it sounds like Access doesnt' like me. :banghead:

Code:
Private Sub Form_Load()
    Me.Spreadsheet6....
End Sub

Thanks for your help.:)
 
The ActiveX control gives generic properties and methods for all ActiveX controls so you need to do this:
Code:
Dim lstMyView As [COLOR="Blue"]ListView[/COLOR]

Set lstMyView = Me.NameOfListViewControl.Object

With lstMyView
     ... do what you want ....
End With
 
Last edited:
Ahhh. I tried creating a new object but didnt got the ref the good way.

It worked. Oh god I can't believe took me so long to figure out such a simple thing. Hard come back into Access 2013. I barely remember that Access 2003 I've did 7-8 years ago! Woop.

Many thanks buddy. Have a great day :D
 

Users who are viewing this thread

Back
Top Bottom