Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 09-08-2017, 07:12 AM
Joe bohen Joe bohen is offline User form combo box change from code behind Windows 10 User form combo box change from code behind Office 2016
Novice
User form combo box change from code behind
 
Join Date: Sep 2017
Posts: 2
Joe bohen is on a distinguished road
Cool User form combo box change from code behind

I have a user form which is launched when the document is opened. A value is chosen from a combobox on the form and some other values are set on textboxes on the form. When the user clicks a command button the value from the combo box is used to find a row on a table in the word document then the index of the selected list item is changed and the user can then click the command button to run the process again.

The problem is that the index is successfully updated and the next value is displayed in the combo box but the value is always empty when read from the code behind.

The code that changes the combo boxes item is very simple:



Private Sub CommandButton1_Click()
On Error GoTo ErrHandle
Dim cmbtxt As String
cmbtxt = InputForm.Datecmb.SelText
Dim idx As Integer
idx = InputForm.Datecmb.ListIndex
'Do some work here
'then set the Datecmb list index to the next index

InputForm.Datecmb.ListIndex = CInt(idx + 1)
' then exit sub
Exit Sub

ErrHandle:
MsgBox (Err.Description)
End If
Resume Next
End Sub

Can anyone sugest what the issue is?
Reply With Quote
  #2  
Old 09-08-2017, 10:52 AM
Joe bohen Joe bohen is offline User form combo box change from code behind Windows 10 User form combo box change from code behind Office 2016
Novice
User form combo box change from code behind
 
Join Date: Sep 2017
Posts: 2
Joe bohen is on a distinguished road
Smile Doh!

Figured it out I was looking at the wrong value I was getting the value from the seltext instead of the value changing this has sorted it out!
Reply With Quote
Reply

Tags
combo box, word vba

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Pasting a table with combo boxes to a new document looses the combo box bobsut@enviro-consult.com Word 1 01-03-2017 01:29 PM
User form combo box change from code behind How to change font and background colors based on Combo Box selection KMan3210 Word VBA 4 12-06-2016 10:11 AM
Hide a combo box (form control), based on a cell value - Excel 2010 jaymudda Excel Programming 9 07-12-2015 10:59 AM
Outlook form - Combo box for deciding who to send form to Sambora Outlook 0 02-09-2014 07:20 AM
VB Code.. COmbo boxes DrewB Word VBA 4 06-10-2009 05:31 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 10:39 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