Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with DTPicker Control graphic

Status
Not open for further replies.

tenbobmillionaire

Programmer
Jun 13, 2000
27
EU
I have inserted a DTPicker control onto an excel spreadsheet as a fairly narrow rectangluar box. When I close and re-open the sheet, the control has resized itself strangely into a much wider box which hides some info on the sheet.
Any ideas what is happening here? If I resize it again and run, its ok, closing and reopening and the same happens.
All help much appreciated
Mick

 
Do you have the option under a context menu of "Move and size with cells" under Format ?

Richard
 
Thanks for the reply, I've tried all 3 options but it makes no difference. Any more ideas?
Mick
 
Can you mail me the control to Don@turnbull.be and I will test it myself ?

Richard
 
Richard

I am using the standard 'Microsoft Date and Time Picker Control 6.0 (SP4)'. You should be able to add this as a control in a VBA application.
Thanks
Mick
 
I found this while I was looking !

Add the control to the forms design Toolbox.
Drag the control from the Toolbox to the custom form page.
Use the Value tab of the control's Properties dialog to bind the control to the appropriate date/time field.
Set the date/time format. (ActiveCalendar seems to require a format like "10 August, 1999" for the binding to work properly.)
Add code to the form's Item_Open event handler to maintain the proper size of the control.

(These controls tend to resize themselves.


Finding the right values for the code may take some trial and error.) Here's an example:
Function Item_Open()
Set oInspector = Item.GetInspector
Set oPage = oInspector.ModifiedFormPages("P.2")
' Error handling in case control is not
'available on machine
On Error Resume Next
Set oControl = oPage.Controls("AC20")
' Height 16 is equal to height 21 defined
' in Outlook property dialog
oControl.Height = 16
If err <> 0 Then
Msgbox &quot;This form requires an additional &quot; & _
&quot;component that does not seem to &quot; & _
&quot;be available on your machine.&quot; & _
vbCrLf & &quot;Please install &quot; & _
&quot;ActiveCalendar from the library.&quot;
err.clear
End If
End Function
 
Thanks for this - I've been trying different sizes for the control and the problem has seemed to have gone using these current particular settings. Strange but true.
Thanks for your help.
Mick
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top