-
VB for Word... Help!
Hey, everybody-
I've just been assigned the task of writing a fairly complicated macro in W0rd 2000 because I have the most programming experience in our MIS dept.
Problem is, The extent of my programming experience is HTML, TI-BASIC, and a teeny weeny little bit of java.
I can't just run the macro recorder, because the people who have requested it are looking for drop-down boxes, etc.
So, If anyone might happen to know of a good resource for me to basically give myself a crash-course in Word VB, I would be eternally grateful.
Thanks in advance.
-11001001
-
i know everything there is to know about MS Office VBA Macros (not to brag, but that's what i've been doing for the last 'year & 1/2') the macro's i write are ungodly complicated and i'm sure that i could help you with just about anything you'd need... alhough i've been working mostly with excel--- i'm sure i can help... ask away!
-take it easy!
-
Thank you TampaBay!!
What I need to do is create a drop-down box that will insert 2 things into the document.
Here's what I mean:
Dropdown box:
Name 1
Name 2
Name 3
Once you select, say, "Name 2" from the box, the macro inserts "Name 2" into the document, along with the person's biography.
If you need more details, let me know.
Thank you!
-
first step...
Create a Visual Basic Combo Box (not the Word COmbo Box, make sure it's the VBA Combobox)...
Code:
Combo1.AddItem Name1
Combo1.AddItem Name2
Code:
Private Sub ComboBox1_Change()
If ComboBox1.Text = Name1 Then
'DO Stuff
End If
End Sub
create a datum array with all the Info in it... I'm going to call mine CRFDATA
Fields is the Count of Array items...
Code:
For i = 0 To Fields
DoEvents
bookmark1 = AddUnderscore(crfdata(i).name, n)
If wdApp.ActiveDocument.Bookmarks.Exists(bookmark1) Then
wdApp.ActiveDocument.FormFields(bookmark1).Range.Text = crfdata(i).value
End If
Next i
Next n
the code above will fill in all Word FormFields with the data that corresponds with their name... if a form field is name "first_name" and the crfdata(i).name = "first_name" then the code above will insert crfdata(i).value into form field "first_name" make any sense?
-
Thanks TampaBay.
Tried to give you greenies, but apparently I gave them to you too recently (last month) regarding the expansion of email headers.
oh well.
Thanks again for your help