From: Jess on 15 Apr 2010 11:19 Thanks for your response. But this is inserting text for me. Maybe a better explaination: I'm creating a word template. And I have to stop the users from being able to delete regular text fields. So I'm inserting labels in. There's a macro that adds more fields. Each line has a label then a rich text field. Here's what I've got so far: Selection.MoveRight Unit:=wdCell Selection.Font.Bold = True Selection.TypeText Text:="Name:" <-- Should be a label Selection.Font.Bold = False Selection.MoveRight Unit:=wdCell Selection.Range.ContentControls.add (wdContentControlRichText) This line inserts a label but I have to change the text: Selection.InlineShapes.AddOLEControl ClassType:="Forms.Label.1" One other method I was trying to do was to use Group, under the Developer bar. But there's a problem with that - The fields are added with the macro ok. But when a user types in the rich text field box - the text is coming out gray instead of black. And when you have the group on - you can't modify any fonts. Help! One last thing - if you could be so kind as to point out a good book for me to follow up on with this I'd really appreciate it. Jess "Doug Robbins - Word MVP" wrote: > A caption consists of a { SEQ } field pre-fixed by the label so if you want > to insert a caption for a Widget, you could use > > With ActiveDocument > Selection.InsertBefore "Widget " > Selection.Collapse wdCollapseEnd > .Fields.Add Selection.Range, wdFieldEmpty, "SEQ widget" > End With > > > -- > Hope this helps. > > Please reply to the newsgroup unless you wish to avail yourself of my > services on a paid consulting basis. > > Doug Robbins - Word MVP, originally posted via msnews.microsoft.com > > "Jess" <Jess(a)discussions.microsoft.com> wrote in message > news:87C4B2DB-D605-42DF-9911-2C7300B697AC(a)microsoft.com... > > How can I do this and change the caption in the label? >
From: Jess on 15 Apr 2010 14:08 Found a solution Sub AddLabel(thisText) Dim lblField As Object Set lblField = _ Selection.InlineShapes.AddOLEControl(ClassType:="Forms.Label.1") With lblField.OLEFormat.Object .Caption = thisText .Width = "125" End With End Sub Thanks again for the help. And if you know of a good text book pls send it over. Jess
First
|
Prev
|
Pages: 1 2 Prev: fieldcodes in textbox formfields Next: Word 2007 VBA- Application.filesearch |