Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 01-26-2010, 05:49 AM
Vivi Vivi is offline Array into ComboBox + Macro-Text into ActiveDocument Windows XP Array into ComboBox + Macro-Text into ActiveDocument Office 2007
Novice
Array into ComboBox + Macro-Text into ActiveDocument
 
Join Date: Jan 2010
Posts: 2
Vivi is on a distinguished road
Default Array into ComboBox + Macro-Text into ActiveDocument

Hello,
I've got a problem while coding with VBA in Word 2007. So, I managed to build a userform and soem macros. Some of them work, left does not.

I have some textboxes (for a letter) including the surnames of yourself and the addressee, the prename of yourself and a combobox where you can switch (will switch hopefully with your help ) between male and female (Dear Sir/Madame [surname]).

What works:


Surnames and Prenames saving after input of the user, but no writing into the document with textmarks.
Autopen the userform when opening a new document template.

What does not work:
Described on top - the combobox does not work, I cannot include "Sir" or "Madame" into the box, tried it with AddItem and Arrays... Some loops and so on.
And the other main point - Writing the finale issues like pre- and surname into the document template (Dear ... ..., [text] Yours faithfully, ...).

Code for Userform:
Code:
Sub AutoOpen() 'Tests with AddItem and so on
    gender.AddItem "Frau"
    gender.AddItem "Herr"
End Sub

Private Sub gender_Click()
    gender.DropDown
End Sub

Private Sub format_Initialize()
    gender.AddItem "Frau"
    gender.AddItem "Herr"
End Sub

Private Sub btnabbrechen_Click() 
    Unload Me ' Close
End Sub

Private Sub btnok_Click() 'OK 'Writing into the document

    ThisDocument.Activate
    If gender = "Frau" Then
    genda = "geehrte Frau"
    Else
    genda = "geehrter Herr"
    End If
    surname = empname
    absender = abprename & " " & abname
    Debug.Print genda, surname, absender
    
    Unload Me ' Box schließen
End Sub
Modul Code:
Code:
Sub AutoNew() 'autoopen 
    format.show
End Sub
So, I hope anyone can help me. I'm trying since yesterday and I didn't make it any better .

I'd appreciate you if you'd help me somehow. Any help's welcome!

Dear Vivi
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Array into ComboBox + Macro-Text into ActiveDocument Combobox manipulation vsempoux Word VBA 3 10-31-2009 08:58 AM
Macro to mark non-coloured/non-highlighted text as hidden PeterB Word 0 10-28-2009 07:54 AM
Selected text and logo in one macro marijke Word VBA 0 08-24-2009 07:01 AM
Array into ComboBox + Macro-Text into ActiveDocument Strip lf/cr from text p3aul Word 9 08-18-2009 12:42 AM

Other Forums: Access Forums

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