Frankie Sharp
New Member
- Joined
- Aug 3, 2014
- Messages
- 1
Hello,
I'm new to VBA and am having trouble setting the size of a string that is being passed to a new word document using excel. I keep getting the error: Run-time error '5843': Method 'Size' of object '_Font' failed. I am using Office 2011.
Help would be greatly appreciated!
I'm new to VBA and am having trouble setting the size of a string that is being passed to a new word document using excel. I keep getting the error: Run-time error '5843': Method 'Size' of object '_Font' failed. I am using Office 2011.
Code:
Option Explicit
Sub CreateBasicWordReport()
Dim wdApp As Word.Application
Set wdApp = New Word.Application
With wdApp
.Visible = True
.Activate
.Documents.Add
With .Selection
.ParagraphFormat.Alignment = wdAlignParagraphCenter
.Font.Bold = True
.Font.Size = 14
.TypeText "Top Movies of 2012"
.Font.Bold = False
.TypeParagraph
.ParagraphFormat.Alignment = wdAlignParagraphLeft
.TypeParagraph
End With
End With
End Sub
Help would be greatly appreciated!