I have this excel file which I have been able to write the data into a Word document through vba for a report. The VBA code is within the excel file containing the data.
I already have most of the code done and it is working properly, but I can not figure out how to tell word (through the vba code in excel) to change the paragraph spacing. Any advice?
I am using the following code to write into word from excel(not the full code just an example):
Dim wdApp As Word.Application
Dim wdDoc As Word.Document
Set wdApp = New Word.Application
Set wdDoc = wdApp.Documents.Add
wdDoc.Content.InsertAfter "Test"
wdDoc.Content.InsertParagraphAfter
wdDoc.SaveAs (file & "\SpecificReport_" & filter & ".doc")
wdDoc.Close
wdApp.Quit
Set wdDoc = Nothing
Set wdApp = Nothing
Recommendation, but not specific answer. If you have any trouble figuring out how to do something from Excel with Word, i find that recording actions in word and reviewing the code generated usually answers that for me.
In this specific instance I came up with the following lines of code:
wdDoc.Content.ParagraphFormat.SpaceBefore = 6wdDoc.Content.ParagraphFormat.SpaceBeforeAuto = False