Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 03-21-2012, 01:07 PM
wperry wperry is offline combo box in word Windows 7 64bit combo box in word Office 2010 32bit
Novice
combo box in word
 
Join Date: Mar 2012
Posts: 1
wperry is on a distinguished road
Default combo box in word

I am creating a new tab in word 2010 for custom templates
My xml file is working great and adds 5 buttons on the tab inserted after the info tab. Beside each button I have a combo box that has 9 items
can anyone tell me how I can make my button onAction event open a
OpenFileDialog
() based on the cbo selection??


Here is the code I am trying


Code:
Sub OnAction(ByVal control As IRibbonControl)
Dim myStream As Stream = Nothing
Dim openFileDialog1 As New OpenFileDialog()
If "cbo01" = "item01" Then
  openFileDialog1.InitialDirectory = \\xxxxxxxxxxx
ElseIf "cbo1" = "item02" Then
  openFileDialog1.InitialDirectory = \\xxxxxxxx
ElseIf "cbo1" = "item03" Then
  openFileDialog1.InitialDirectory = \\xxxxxx
ElseIf "cbo1" = "item04" Then
  openFileDialog1.InitialDirectory = \\xxxxxxx
ElseIf "cbo1" = "item05" Then
  openFileDialog1.InitialDirectory = \\xxxxxxxxx
ElseIf "cbo1" = "item06" Then
  openFileDialog1.InitialDirectory = \\xxxxxxxxx
ElseIf "cbo1" = "item07" Then
  openFileDialog1.InitialDirectory = \\xxxxxxxxx
ElseIf "cbo1" = "item08" Then
  openFileDialog1.InitialDirectory = \\xxxxxxxx
ElseIf "cbo1" = "item09" Then
  openFileDialog1.InitialDirectory = \\xxxxxxxx
End If
openFileDialog1.ShowDialog()
End Sub
TIA

Last edited by macropod; 03-22-2012 at 06:48 AM. Reason: Added code tags
Reply With Quote
  #2  
Old 03-22-2012, 06:53 AM
macropod's Avatar
macropod macropod is offline combo box in word Windows 7 64bit combo box in word Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,384
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Hi wperry,

Your code appears to be .NET code, not vba. The OpenFileDialog class is not part of the Word vba object model. See: http://msdn.microsoft.com/en-us/libr...dialog.aspx#Y0
Also, vba doesn't accept variable declarations of the kind you're using.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
combo box in word Combo Box in VB Forms help Cbrehm Excel Programming 5 05-13-2011 03:08 AM
combo box in word Combo Box populate from range ioustinos Excel 1 09-01-2010 09:18 AM
Combo Box in whole column ioustinos Excel 1 09-01-2010 01:24 AM
VB Code.. COmbo boxes DrewB Word VBA 4 06-10-2009 05:31 AM
combo box in word Hide a combo box DrewB Word 3 06-08-2009 11:29 PM

Other Forums: Access Forums

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