[AccessD] URGENT: Creating Actiive-X control on form

Erwin Craps - IT Helps Erwin.Craps at ithelps.be
Mon Jan 10 07:03:03 CST 2005

I seem to be stuck on this one.
I want to create a Active-X control on a form from VBA code.
In my example down here I want a Excel control but, in my code I will
create multiple types of Active-X controls.
The thing is my code does'nt seem to work, altough I believe it should.
The control just stays an empty frame.
What am I missing here?
Sub DoIT ()
    Dim frm As Form
    Dim ctlTemp As Control
    Set frm = CreateForm
    frm.Visible = True
    Set ctlTemp = CreateControl(frm.Name, acCustomControl, , , , 10, 10,
5000, 500)
    ctlTemp .Class = "Excel.Sheet"    ' Set class name.
    Set frm = Nothing
    Set ctlTemp = Nothing

end sub


Erwin Craps




This E-mail is confidential, may be legally privileged, and is for the
intended recipient only. Access, disclosure, copying, distribution, or
reliance on any of it by anyone else is prohibited and may be a criminal
offence. Please delete if obtained in error and E-mail confirmation to
the sender.

IT Helps - I.T. Help Center  ***  Box Office Belgium & Luxembourg

www.ithelps.be <http://www.ithelps.be/>   *  www.boxoffice.be
<http://www.boxoffice.be/>   *  www.stadleuven.be

IT Helps bvba* ** Mercatorpad 3 **  3000 Leuven

IT Helps  *  Phone: +32 16 296 404  *  Fax: +32 16 296 405 E-mail:
Info at ithelps.be 

Box Office **  Fax: +32 16 296 406 **  Box Office E-mail:
Staff at boxoffice.be <mailto:figures at boxoffice.be> 


More information about the AccessD mailing list