31/05/2020, 12:08
Vba Kod İle Word Dosyası Oluşturmak için
Dim objWord As Word.Application
Dim doc As Word.Document
Dim WordHeaderFooter As HeaderFooter
Set objWord = CreateObject("Word.Application")
With objWord
.Visible = True
Set doc = .Documents.Add
doc.SaveAs CurrentProject.Path & "\TestDoc.doc"
End With
With objWord.Selection
.Font.Name = "Trebuchet MS"
.Font.Size = 16
.TypeText "Here is an example test line, #" & " - Font size is " & .Font.Size
.TypeParagraph
'Add header and footer
ActiveDocument.Sections(1).Headers(wdHeaderFooterPrimary).Range.Text = "Header"
ActiveDocument.Sections(1).Footers(wdHeaderFooterPrimary).Range.Text = "Footer"
End With
doc.Save
doc.Activate