2017-05-16 1 views
0

Ich versuche, ein Makro in VBA zu erstellen, was der Titel sagt (ich denke, es ist ziemlich klar). Ich weiß nicht, welche Funktionen zu verwenden sind. DieseMakro in VBA, Fettschrift> * Fettschrift *; Kursiv> _italic_ (WhatsApp Zweck)

ist das, was ich suche (teilweise):

Sub FormatForWhatsapp() 
With Selection.Find 
    .ClearFormatting 
    .Font.Bold = True 
    .Text = "" 
    .Replacement.Text = "*^&*" 
    .Forward = True 
    .Wrap = wdFindContinue 
    .Format = True 
End With 
Selection.Find.Execute Replace:=wdReplaceAll 

With Selection.Find 
    .ClearFormatting 
    .Font.Italic = True 
    .Text = "" 
    .Replacement.Text = "_^&_" 
    .Forward = True 
    .Wrap = wdFindContinue 
    .Format = True 
End With 
Selection.Find.Execute Replace:=wdReplaceAll 

End Sub 

Mein Problem ist 1) Ich brauche einen nativen Code und nicht das Büro Funktion „Suchen“. 2) Ich brauche auch einen Code, der die umgekehrte Aktion zum Neuformatieren ausführt.

Vielen Dank im Voraus

+2

"Ich denke, es ist ziemlich klar" - Nö. –

+0

Was ist nicht klar? –

+0

Was genau ist ein "nativer Code"? –

Antwort

0

Hier ist mein Code für die Makros! Machen Sie einfach View-Makros und bearbeiten und fügen Sie meinen Code ein!

Bold für WhatsApp:

Sub bold() 
' 
' bold Makro 
' Wahtsapp bold 
' 
' Tastenkombination: Strg+b 
' 
    ActiveCell.FormulaR1C1 = "*" & ActiveCell.FormulaR1C1 & "*" 
End Sub 

Kursiv für WhatsApp:

Sub Italic() 
' 
' Italic Makro 
' Whatsapp Italic 
' 
' Tastenkombination: Strg+i 
' 
    ActiveCell.FormulaR1C1 = "_" & ActiveCell.FormulaR1C1 & "_" 
End Sub 
+0

Danke! Aber ich suche nach einem Skript, das fett oder kursiven Text findet und fügt sie hinzu. –