![]() |
|
|
|
#1
|
|||
|
|||
|
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
Code:
Sub AutoNew() 'autoopen
format.show
End Sub
.I'd appreciate you if you'd help me somehow. Any help's welcome! Dear Vivi |
|
#2
|
|||
|
|||
|
Thank you dudes, I managed to solve my problems by myself.
And did some other problems too, so my program is ready and I'm glad it is! If anybody gets same problems, don't be too shy to ask, I shall answer .
|
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
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 |
Strip lf/cr from text
|
p3aul | Word | 9 | 08-18-2009 12:42 AM |