IT-Academy

Tvorba a formátovanie dokumentu Word VBA

Dec 1st, 2016
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Sub otvorWordDokument()
  2.    
  3.     Dim objWord
  4.     Dim objDokument
  5.     Dim objVyber
  6.    
  7.     Set objWord = CreateObject("Word.Application")
  8.     Set objDokument = objWord.Documents.Open("D:\Subor.docx")
  9.    
  10.     objWord.Visible = True
  11.  
  12. '    ' Vytlaè dokument
  13. '    objDokument.PrintOut
  14.    
  15. '
  16.    Set objVyber = objWord.Selection
  17.     objVyber.Font.Bold = True
  18.     objVyber.Font.Size = "22"
  19.  
  20.     objVyber.TypeText ("Práve som zapísal nieèo do Wordu2..." & vbCrLf)
  21.     objDokument.Save
  22. '
  23. '    ' Vypni Word
  24.  
  25.      objWord.Quit
  26.    
  27. End Sub
Advertisement
Add Comment
Please, Sign In to add comment