Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 08-04-2015, 09:26 PM
ickelly ickelly is offline How do I code ListBox and DatePicker in UserForm? - Word 2013 Windows 8 How do I code ListBox and DatePicker in UserForm? - Word 2013 Office 2013
Novice
How do I code ListBox and DatePicker in UserForm? - Word 2013
 
Join Date: Aug 2015
Posts: 2
ickelly is on a distinguished road
Default How do I code ListBox and DatePicker in UserForm? - Word 2013

Hello,



I have prepared a proposal template for our company that contains a "Date" field and a "Projoct Cost" field. In the template, I used a date picker content control and a drop-down list content control for these fields.

When I design the user form in the VBE, I don't see the option to include a date picker or drop-down list. According to Greg Maxey's user form page (http://gregmaxey.com/word_tip_pages/..._userForm.html), including these tools in the user form requires a reference to the Microsoft Forms 2.0 Object Library and Microsoft Windows Common Controls-2.6.0. I'm using Word 2013, and not able to access either through VBE Tools>References.

Does anyone know of any alternate ways of coding input boxes in a user form that will allow for this functionality?

Thanks,

Ian
Reply With Quote
  #2  
Old 08-04-2015, 10:57 PM
Guessed's Avatar
Guessed Guessed is offline How do I code ListBox and DatePicker in UserForm? - Word 2013 Windows 7 32bit How do I code ListBox and DatePicker in UserForm? - Word 2013 Office 2010 32bit
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,977
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

The drop down list doesn't require any special references but the datepicker is another matter. The Greg Maxey page you pointed us at includes the following information

"Note: Unfortunately Microsoft no longer includes the Microsoft Windows Common Control-2-6-0 (SP3) in the resource library. You need this reference for the DateAndTimePicker control to work. If you are unable to find it in the list of available resources then you will need to download MSCOMCT2.OCX (see Office Help & Support KB 297381). Once you save MSCOMCT2.OCX in your system directory (e.g., C:\Windows\System32 on 32-bit or C:\Windows\Syswow64 on 64-bit), you need to register it. Click "Start" then "Run," type in regsvr32 and then the path to the file e.g., c:\windows\syswow64\mscomct2.ocx, then click OK. If you don't want to go the trouble of doing this, I have included a second Userform in the .dot version of the Student Survey Form template that substitutes a Textbox control for birthday and omits the DateAndTimePicker control."
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
  #3  
Old 08-05-2015, 04:54 AM
ickelly ickelly is offline How do I code ListBox and DatePicker in UserForm? - Word 2013 Windows 8 How do I code ListBox and DatePicker in UserForm? - Word 2013 Office 2013
Novice
How do I code ListBox and DatePicker in UserForm? - Word 2013
 
Join Date: Aug 2015
Posts: 2
ickelly is on a distinguished road
Default

Thanks for the reply. If the drop-down list doesn't need any special references, then how do I code it to set the selections that appear in the drop-down on the user form? Is there a way to bind it to the content control in the document and read the drop-down selections from that document property, as the content control has already been created and the drop-down selections in the control and the user form box must match.
Thanks.
Reply With Quote
  #4  
Old 08-05-2015, 05:23 AM
gmayor's Avatar
gmayor gmayor is offline How do I code ListBox and DatePicker in UserForm? - Word 2013 Windows 7 64bit How do I code ListBox and DatePicker in UserForm? - Word 2013 Office 2010 32bit
Expert
 
Join Date: Aug 2014
Posts: 4,106
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

The primary forms elements are contained in FM20.DLL. Set a reference to Microsoft Forms 2.0 Object library.

Occasionally some users have reported FM20.DLL missing or unregistered ( in which case you will not be able to set the reference).

If your PC is 64 bit (as most recent models are) then that file should be in the folder C:\Windows\SysWOW64, though it may be in C:\Windows\System32 in which case copy it to the other folder. You will then need to register it as described above (though you should register it as administrator).

Date pickers are a problem as invariable the OCX file will be unregistered and it must be registered on every PC. It will not work with the 64 bit versions of Office. I would therefore recommened using a VBA picker. I personally like Trevor Eyre's version which you can download from http://bit.ly/1ossyMA
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
  #5  
Old 08-05-2015, 04:07 PM
Guessed's Avatar
Guessed Guessed is offline How do I code ListBox and DatePicker in UserForm? - Word 2013 Windows 7 32bit How do I code ListBox and DatePicker in UserForm? - Word 2013 Office 2010 32bit
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,977
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

To populate the userform combobox with the values from a document Content Control I would try code similar to the following.
Code:
Private Sub UserForm_Initialize()
  Dim i As Integer
  With ActiveDocument.ContentControls(1).DropdownListEntries
    For i = 1 To .Count
      Me.cbTest.AddItem .Item(i).Text
    Next i
  End With
End Sub
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I code ListBox and DatePicker in UserForm? - Word 2013 Moving Selected Items from a Multiselect Listbox on a userform to a bookmark in Word marksm33 Word VBA 3 01-15-2015 07:55 PM
VBA Code in a UserForm module to delete a Command Button which opens the userform Simoninparis Word VBA 2 09-21-2014 03:50 AM
This is a Userform LIstbox queston: A variable does not set to the value of a listbox CatMan Excel Programming 14 08-18-2014 08:14 PM
How do I code ListBox and DatePicker in UserForm? - Word 2013 This is a Userform LIstbox queston: A variable does not set to the value of a listbox CatMan Excel 1 08-08-2014 09:41 AM
Userform Code not quite right - help please vbanovice Word VBA 1 09-29-2013 09:20 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:24 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft