I am trying to format a word document saved as an RTF from VBA after already posting data into it in the same macro.
The path output I am using is saved as a string and not an object which I think might be causing the problem but im not sure. My code is below.


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"


Close #1
Close #2


End Sub





The values in quotations are saved named ranges in my excel document with the location and names of the files I am using.
I am trying to format the word document to have font size of 14 and top/bottom margins of 2.25.
My guess so far was to use the WITH function in VBA but I was not having any luck.

'With PrintOutput.Object.PageSetup
' .TopMargin = wrdApp.InchesToPoints(2.25)
' .BottomMargin = wrdApp.InchesToPoints(2.25)
' .Font.Size = 14
'End With


If anyone has any tips or any other advice in general I would greatly appreciate it.

Thanks!