Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 05-24-2011, 12:16 AM
ilkks ilkks is offline Code to export value from ComboBox Windows Vista Code to export value from ComboBox Office 2007
Novice
Code to export value from ComboBox
 
Join Date: May 2011
Posts: 23
ilkks is on a distinguished road
Default Code to export value from ComboBox


I have MACROBUTTON, that launches UserForm, that contains ComboBox. What is the code to export chosen value from ComboBox to document as text.

I have this code:

Code:
Private Sub UserForm_Initialize()
  With cboFood
      .AddItem "Apple"
      .AddItem "Pie"
      .AddItem "Meat"
      .AddItem "Squirrel"
      .AddItem "Banana"
      .AddItem "Nuts"
   End With
End Sub

____________________________________

Private Sub cmdOK_Click()

    With ActiveDocument
        .Bookmarks("Food).Range.Text = cboFood.Value
    End With
    Application.ScreenUpdating = True
    Unload Me

End Sub
And it exports the chosen value by updating it to the bookmark. It works, But I want it to be exported as text that overrides the MACROBUTTON.

I think the code that I am looking for is something like this:

Code:
Private Sub cmdOK_Click()

 Selection.TypeText Text:="cboFood.Value"
 Unload Me

End Sub
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Textbox updating from combobox selection paxile2k Word VBA 0 10-26-2010 02:30 PM
How to use the content of a combobox for {IF} field? Melaanie Word 0 06-14-2010 02:00 AM
Code to export value from ComboBox Array into ComboBox + Macro-Text into ActiveDocument Vivi Word VBA 1 01-27-2010 07:03 AM
Code to export value from ComboBox Combobox manipulation vsempoux Word VBA 3 10-31-2009 08:58 AM
Export/Import Arkmom Outlook 0 03-31-2009 02:47 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 09:59 PM.


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