Hi..
i'm trying to open a wordpro document in vb and generate a letter,by which part of the data are from the database.
for now, i'm using this method but i don't think it is a good practice....
Dim oword As Object
Dim WordProDoc As Object
Set oword = CreateObject("Word.Application"![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
With oword
.Documents.Add 'Open blank MSWord document
.Selection.Font.Name = "Arial"
.
.
.
.Selection.TypeParagraph
.Selection.TypeParagraph
.Selection.Font.Bold = True
.Selection.Font.Underline = True
.Selection.TypeText ("LETTER OF APPOINTMENT"![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
.Selection.Font.Bold = False
.Selection.Font.Underline = False
.
.
'to insert data from db
.Selection.TypeText ("( " & rsInduk!P_name & " )"![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
.Selection.TypeParagraph
.ActiveDocument.SaveAs ("E:\SPAN\MySpan2\pelantikan tetap.lwp"![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
.Quit
End With
Set WordProDoc = GetObject("E:\SPAN\MySpan2\pelantikan tetap.lwp", "WordPro.Document"![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
WordProDoc.Application.ActiveDocWindow.Show
'clear the recordset on the way out
Set rsInduk = Nothing
MsgBox "process completed, double click on the Wordpro icon to view the letter", vbInformation
OLE1.Enabled = True
i'm trying to open a wordpro document in vb and generate a letter,by which part of the data are from the database.
for now, i'm using this method but i don't think it is a good practice....
Dim oword As Object
Dim WordProDoc As Object
Set oword = CreateObject("Word.Application"
With oword
.Documents.Add 'Open blank MSWord document
.Selection.Font.Name = "Arial"
.
.
.
.Selection.TypeParagraph
.Selection.TypeParagraph
.Selection.Font.Bold = True
.Selection.Font.Underline = True
.Selection.TypeText ("LETTER OF APPOINTMENT"
.Selection.Font.Bold = False
.Selection.Font.Underline = False
.
.
'to insert data from db
.Selection.TypeText ("( " & rsInduk!P_name & " )"
.Selection.TypeParagraph
.ActiveDocument.SaveAs ("E:\SPAN\MySpan2\pelantikan tetap.lwp"
.Quit
End With
Set WordProDoc = GetObject("E:\SPAN\MySpan2\pelantikan tetap.lwp", "WordPro.Document"
WordProDoc.Application.ActiveDocWindow.Show
'clear the recordset on the way out
Set rsInduk = Nothing
MsgBox "process completed, double click on the Wordpro icon to view the letter", vbInformation
OLE1.Enabled = True