Zum Inhalt springen

kleines Prob in VBA


UTGMK

Empfohlene Beiträge

Hi Leute

ich hab hier ein kleines Problem in Microsoft Word. Mir gefallen die einträge Artikel.hide und Artikel.show nicht (Fett)

Wie könnte ich diese schreibvariante ändern

Private Sub CommandButton1_Click()

If TextBox1 > "" Then

If CheckBox1 = True And CheckBox2 = True Then

MsgBox "Bitte kreuzen Sie nur ein Feld an"

Artikel.hide

Artikel.show

Else

If CheckBox1 = False And CheckBox2 = False Then

MsgBox "Bitte kreuzen Sie ein Feld an"

Artikel.hide

Artikel.show

Else

If CheckBox1 = True Then

ActiveDocument.Bookmarks("Kontrollkästchen1").Select

Selection.TypeText Text:="X"

Else

ActiveDocument.Bookmarks("Kontrollkästchen2").Select

Selection.TypeText Text:="X"

End If

End If

End If

End If

If CheckBox1 = True And CheckBox2 = False Or CheckBox1 = False And CheckBox2 = True Then

ActiveDocument.Bookmarks("Text1").Select

Selection.TypeText Text:=TextBox1.Value

ActiveDocument.Bookmarks("Text2").Select

Selection.TypeText Text:=TextBox2.Value

ActiveDocument.Bookmarks("Text3").Select

Selection.TypeText Text:=TextBox3.Value

ActiveDocument.Bookmarks("Text4").Select

Selection.TypeText Text:=TextBox4.Value

ActiveDocument.Bookmarks("Text5").Select

Selection.TypeText Text:=TextBox5.Value

ActiveDocument.Bookmarks("Text6").Select

Selection.TypeText Text:=TextBox6.Value

ActiveDocument.Bookmarks("Text7").Select

Selection.TypeText Text:=TextBox7.Value

ActiveDocument.Bookmarks("Text8").Select

Selection.TypeText Text:=TextBox8.Value

ActiveDocument.Bookmarks("Text9").Select

Selection.TypeText Text:=TextBox9.Value

ActiveDocument.Bookmarks("Text10").Select

Selection.TypeText Text:=TextBox10.Value

Fertig.Show

Artikel.hide

End If

Link zu diesem Kommentar
Auf anderen Seiten teilen

Was willst du denn damit bezwecken dass du die ein und die selbe Form mal auf, mal zu machst? :confused:

Wenn kein anderes Fenster gleichzeitig angewählt werden soll (z.B. duch Alt+Tab) dann musst du Form.show vbModal

Eingeben.

Ansonsten musst du mal näher erklären, was du machen willst...

Link zu diesem Kommentar
Auf anderen Seiten teilen

Eine Fehlermeldung legt sich automatisch über das Formular, und das Formular bleibt eigentlich im Hintergrund, sofern du nicht unload.me oder form.hide sagst. Von daher brauchst du das mit dem hide und show gar nicht.

Probiers einfach mal an einem Leeren Formular aus.

Private Sub Form_Load()

msgbox "Hallo"

End Sub

Die Form bleibt stehen und die msgbox wird darübergelegt, bis du sie Wegklickst.

Link zu diesem Kommentar
Auf anderen Seiten teilen

Dein Kommentar

Du kannst jetzt schreiben und Dich später registrieren. Wenn Du ein Konto hast, melde Dich jetzt an, um unter Deinem Benutzernamen zu schreiben.

Gast
Auf dieses Thema antworten...

×   Du hast formatierten Text eingefügt.   Formatierung wiederherstellen

  Nur 75 Emojis sind erlaubt.

×   Dein Link wurde automatisch eingebettet.   Einbetten rückgängig machen und als Link darstellen

×   Dein vorheriger Inhalt wurde wiederhergestellt.   Editor leeren

×   Du kannst Bilder nicht direkt einfügen. Lade Bilder hoch oder lade sie von einer URL.

Fachinformatiker.de, 2024 by SE Internet Services

fidelogo_small.png

Schicke uns eine Nachricht!

Fachinformatiker.de ist die größte IT-Community
rund um Ausbildung, Job, Weiterbildung für IT-Fachkräfte.

Fachinformatiker.de App

Download on the App Store
Get it on Google Play

Kontakt

Hier werben?
Oder sende eine E-Mail an

Social media u. feeds

Jobboard für Fachinformatiker und IT-Fachkräfte

×
×
  • Neu erstellen...