![]() |
#2
|
||||
|
||||
![]()
Maybe something like:
Code:
Sub Textbox() Dim wdApp As Object Dim wdDoc As Object Dim wdShp As Object Dim oRng As Object On Error Resume Next Set wdApp = GetObject(, "Word.Application") 'It is always faster to get the running Word if available If Err Then Set wdApp = CreateObject("Word.Application") End If On Error GoTo 0 With wdApp .Visible = True .ScreenUpdating = False Set wdDoc = wdApp.Documents.Add Set wdShp = wdDoc.Shapes.AddTextbox(Orientation:=msoTextOrientationUpward, _ Left:=10, _ Top:=10, _ Width:=wdApp.CentimetersToPoints(1.25), _ Height:=wdApp.CentimetersToPoints(10)) With wdShp Set oRng = .TextFrame.TextRange With oRng .Text = "This is the text box text" .Font.Name = "Times New Roman" .Font.Size = 14 .Font.Italic = True .ParagraphFormat.Alignment = 1 'Centred End With End With .ScreenUpdating = True End With lbl_exit: Set wdDoc = Nothing: Set wdApp = Nothing: Set wdShp = Nothing Exit Sub End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
IanM_01 | Word | 5 | 11-21-2015 02:29 AM |
Insert superscript into a textbox | Deltaj | Word VBA | 3 | 11-30-2014 04:23 PM |
insert text in freeform graphic (make it a textbox) | fzr | Word | 2 | 09-03-2014 05:54 AM |
![]() |
scarymovie | Word VBA | 5 | 05-16-2012 07:05 PM |
How to insert a hyperlink in activex textbox | Joe Patrick | Word VBA | 1 | 10-03-2011 06:03 AM |