VB for Word... Help!
Results 1 to 5 of 5

Thread: VB for Word... Help!

  1. #1
    BS, EnCE, ACE, Cellebrite 11001001's Avatar
    Join Date
    Mar 2002
    Location
    Just West of Beantown, though nobody from Beantown actually calls it "Beantown."
    Posts
    1,229

    Question 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
    That's Officer 11001001 to you...
    Now you see me | Now you don't
    "Relax, Bender; It was just a dream. There's no such thing as two." ~ Fry
    sometimes my computer goes down on me

  2. #2
    Senior Member tampabay420's Avatar
    Join Date
    Aug 2002
    Posts
    953
    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!
    yeah, I\'m gonna need that by friday...

  3. #3
    BS, EnCE, ACE, Cellebrite 11001001's Avatar
    Join Date
    Mar 2002
    Location
    Just West of Beantown, though nobody from Beantown actually calls it "Beantown."
    Posts
    1,229
    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!
    That's Officer 11001001 to you...
    Now you see me | Now you don't
    "Relax, Bender; It was just a dream. There's no such thing as two." ~ Fry
    sometimes my computer goes down on me

  4. #4
    Senior Member tampabay420's Avatar
    Join Date
    Aug 2002
    Posts
    953
    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?
    yeah, I\'m gonna need that by friday...

  5. #5
    BS, EnCE, ACE, Cellebrite 11001001's Avatar
    Join Date
    Mar 2002
    Location
    Just West of Beantown, though nobody from Beantown actually calls it "Beantown."
    Posts
    1,229
    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
    That's Officer 11001001 to you...
    Now you see me | Now you don't
    "Relax, Bender; It was just a dream. There's no such thing as two." ~ Fry
    sometimes my computer goes down on me

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •