I have a customer management application that deals with credit ratings, inventory management and sales history. Within the Credit Rating section, I have a button that, when clicked, generates a MS Word document and populates it with customer rating data pulled from a SQL 2005 db.
I have not been able to test this section of code, however, because I keep generating Late Binding errors with the WordApp object. I added the Microsoft Office 12.0 Object Library COM reference, however that did not appear to fix anything. Any suggestions your fixes you can offer would be most appreciated.
Thanks for your time.
Dim WordApp As Object = CreateObject("Word.Application")
Dim doc As Object = WordApp.documents.add
'add text to document
.font.size = WordApp.selection.font.size + 2
WordApp.visible = True
Dim fName As String
SaveFileDialog1.Filter = "Documents|*.doc"
fName = SaveFileDialog1.FileName
If fName <> "" Then
Catch ex As Exception
MessageBox.Show("Failed to save document" & vbCrLf & ex.Message)