Guest_imported
New member
- Jan 1, 1970
- 0
Hi,
I am having a problem with a VB app I am trying to create that should print out a word file.
Here is the code of the offending class:
Option Explicit
Public Sub ShowMessage(ByVal MSG As String)
Dim sFileName As String
Dim iFileNum As Integer
Dim oWord As Word.Document
Dim oWordApp As Word.Application
sFileName = App.Path & "/DCOMTest.htm"
iFileNum = FreeFile
Open sFileName For Output As #iFileNum
Print #iFileNum, MSG
Close #iFileNum
'I have tried both of the following lines and received the same error.
'If I comment out the lines below the program works fine.
'---------------------------------------
Set oWordApp = Word.Application
'Set oWordApp = CreateObject("Word.Application"
'--------This is the offending block----
'Set oWord = oWordApp.Documents.Open(sFileName, False, True, False)
'oWord.PrintOut
'oWord.Close
'Set oWord = Nothing
'Set oWordApp = Nothing
End Sub
This code gives me a type mismatch. Can anyone see why?
Thanks,
Phil Lamey
I am having a problem with a VB app I am trying to create that should print out a word file.
Here is the code of the offending class:
Option Explicit
Public Sub ShowMessage(ByVal MSG As String)
Dim sFileName As String
Dim iFileNum As Integer
Dim oWord As Word.Document
Dim oWordApp As Word.Application
sFileName = App.Path & "/DCOMTest.htm"
iFileNum = FreeFile
Open sFileName For Output As #iFileNum
Print #iFileNum, MSG
Close #iFileNum
'I have tried both of the following lines and received the same error.
'If I comment out the lines below the program works fine.
'---------------------------------------
Set oWordApp = Word.Application
'Set oWordApp = CreateObject("Word.Application"
'--------This is the offending block----
'Set oWord = oWordApp.Documents.Open(sFileName, False, True, False)
'oWord.PrintOut
'oWord.Close
'Set oWord = Nothing
'Set oWordApp = Nothing
End Sub
This code gives me a type mismatch. Can anyone see why?
Thanks,
Phil Lamey