You are on page 1of 1

https://www.youtube.com/watch?

v=hCFlnrv479c
Private Sub cmdGenerar_Click()
Dim MSWord As New Word.Application
Dim Documento As Word.Document
Dim strFile As String
strFile = "MEMO_" & Mid(txtNomPer.Text, 1, 2) & Mid(txtApePer.Text, 1, 2) &
Day(Date) & Month(Date) & "-" & Minute(Time) & "" & Second(Time) & ".docx"
FileCopy "Z:\SistemaIntegral\img\docs\MEMORANDUM.docx", "C:\" & strFile
Set Documento = MSWord.Documents.Open("C:\" & strFile)
Documento.Bookmarks.Item("NUMERO").Range.Text = Format(intNroMemo, "0000")
Documento.Bookmarks.Item("FECHAHOY").Range.Text = Date
Documento.Bookmarks.Item("PERSONAL").Range.Text = Trim(txtNomPer.Text) & " "
& Trim(txtApePer.Text)
Documento.Bookmarks.Item("ASUNTO").Range.Text = cbxTipoMemo.Text
Documento.Bookmarks.Item("MOTIVO").Range.Text = txtDesFalta.Text
Documento.Bookmarks.Item("FECHA").Range.Text = txtFecFalta.Text
Documento.Bookmarks.Item("SANCION").Range.Text = cbxSancion.Text
MSWord.Visible = True
Set MSWord = Nothing
End Sub?

You might also like