1
Word / Antw:Office 2010: VBA: Inhaltsteuerelement (Word) in Textmarke einschließen
« am: September 13, 2012, 17:14:23 Nachmittag »
ich wäre wirklich über jede hilfe dankbar (bitte bitte bitte) - bei der range verlegung steh ich einfach aufm schlauch.
hier meine gehversuche:
hier meine gehversuche:
Code: [Auswählen]
Dim objCC As ContentControl
Dim oContentControl As Range
If TextBox1.Visible = True Then
If ActiveDocument.Bookmarks.Exists("Feld") Then
Set Marke1 = ActiveDocument.Bookmarks("Feld").Range
Marke1.Text = TextBox1.Text & ":"
ActiveDocument.Bookmarks.Add Name:="Feld", Range:=Marke1
End If
If ActiveDocument.Bookmarks.Exists("Feld2") Then
Set Marke2 = ActiveDocument.Bookmarks("Feld2").Range
Set objCC = Marke2.ContentControls.Add(wdContentControlText)
objCC.SetPlaceholderText Text:="[" & TextBox1.Text & "]"
objCC.Title = TextBox1.Text
'Set Marke3 = objCC.Range
'Set Marke2 = ActiveDocument.objCC(TextBox1.Text).Range
'Muss noch überarbeitet werden!
'Selection.Words.Last.Next.Select
'ActiveDocument.Bookmarks("Feld2").Range.Characters.Last.Select
'Selection.Collapse wdCollapseStart
'Selection.TypeText "Material below is confidential."
'Set oContentControl = SelectedContentControl
'Set oContentControl = ActiveDocument.ContentControls(1).Range
'Set oContentControl = objCC.Range
'oContentControl.Collapse Direction:=wdCollapseStart
ActiveDocument.Bookmarks.Add Name:="Feld2", Range:=Marke2
End If
End If