VBA help.

Man of Honour
Joined
30 Oct 2003
Posts
14,099
Location
Essex
I am a little stuck with some vba... what I want to achieve is that when a user clicks "save as" a dropdown list appears allowing the selection of one of 3 or so values, once a value is selected a text box will then appear asking the user to type a value, these values will then be concatenated and added to the footer of the document.

so far I have:

Code:
Public Sub FileSaveAs()

   Dim MyText As String

   strData = InputBox("value here....")
   
   With ActiveDocument.Sections(1)
   .Footers(wdHeaderFooterPrimary).Range.Text = strData
   End With

   MsgBox ("The footer has been updated")

ActiveDocument.Save
End Sub

Now this does half the task and allows me to input some data into a text box, click ok and the footer is updated however having not used vba in as long as I can remember the dropdown list is evading me...

Any help much appreciated.
 
I dont think you can add a combobox to to an input box, you will probably have to create a custom form for that type of functionality.

When you initialize your custom form you can easily add items to it by using:
Code:
With ComboBox1
   .AddItem "Item 1"
   .AddItem "Item 2"
   .AddItem "Item 3"
   .AddItem "The best item!"
End With
 
Yea I saw that there was a way of adding values to combo boxes and dropdown boxes in the object model however the document does not have a combo box in it to add values. What I want is to display a combo box when the vba runs on save, the value selected will then be stored in a variable in the code. Once the code has then run it will then be used to update a footer.
 
Back
Top Bottom