View Full Version : Using ActiveX Objects in Excel
Eugeneb
05-03-2007, 06:42 PM
Hi I would like to use the datetime picker activeX in Excel.How do I access the objects properties (value) so I can then use this in a cell on say sheet2?I Assume I would have to create a public variable that and make it equal the value of the ActiveX object? How do I use this in a Cell?
Bob Phillips
05-03-2007, 06:54 PM
See http://www.rondebruin.nl/calendar.htm
johnske
05-03-2007, 09:45 PM
Hi Eugeneb,
I assume you're referring to the date-time picker control in mscomct2.ocx
I've used the calendar control in this file but haven't used the date-time picker, however you can refer to its' properties using DTPicker1 as in this example...
Option Explicit
Private Sub Worksheet_Activate()
With DTPicker1
.Height = "20"
.Width = "70"
.Month = 1
Range("A1") = .Value
End With
End Sub
or Private Sub DTPicker1_Click()
Range("A1") = DTPicker1.Value
End Sub
however you need to note that while these particular controls are far more attractive and look more professional than the standard calendar control, both are 'non-standard', so if you intend to distribute workbooks using these controls you also need to distribute the ocx file with them and give instructions for installing and registering the controls. Alternatively, you can download this (http://xlvba.3.forumer.com/index.php?showtopic=62) zip file that installs & registers them and distribute it with your w/book...
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.