I am using a with function to format an RTF document after putting data into it. I am using a WITH statement and have successfully changed the margins and the font size but the paragraph formats dont seem to update.
I am somewhat new to using WITH functions and object manipulation in general.
My code I am using is below.
It does not error out but instead does not apply any of the paragraph formats. I need 5.75 line spacing with exact spacing as opposed to single or double.
Option Explicit Sub MyMacro() Dim TargetPath As String Dim TargetFile As String Dim OutputPath As String Dim PrintableOutputFile As String Dim PrintOutput As String Dim PathInput As String TargetPath = Range("Target_Path").Value TargetFile = Range("target_file").Value OutputPath = Range("Output_Path").Value PrintableOutputFile = Range("printable_output_file").Value PathInput = Range("target_path").Value & "\" & Range("target_file").Value PrintOutput = Range("output_path").Value & "\" & Range("printable_output_file").Value Open PathInput For Input As #1 Open PrintOutput For Output As #2 Print #2, "My Data here" Set wrdApp = GetObject(PrintOutput) With wrdApp .PageSetup.TopMargin = Application.InchesToPoints(2.25) .PageSetup.BottomMargin = Application.InchesToPoints(2.25) .Content.Font.Size = 14 .Content.ParagraphFormat.LineSpacingrule = wdlinespaceExactly .Content.ParagraphFormat.linespacing = 5.75 End With Close #1 Close #2 End Sub
Any help or tips would be greatly appreciated as I am still learning and appreciate all input. Thanks!





Reply With Quote
