D
Daniel
I have below code for visual basic project control using visual studio 6.
----------------
Sub PrintWord(loWord As Object, printopt As String)
opt1 = printopt
If opt1 = "p" Then
If retval1 > 0 Then
loWord.Options.PrintBackground = False
loWord.PrintOut Copies = 1
End If
loWord.Application.Quit 0
Else
loWord.Visible = True
End If
End Sub
Sub testPrint()
Dim loWord As Object
Dim doc1 As Object
Dim p1 As String
Dim loSel As Object
Set loWord = CreateObject("Word.Application")
Set loWord.Visible = True
Set doc1 = loWord.Documents.Open("C:\work\test1.doc")
Set loSel = loWord.Selection
p1 = ""
PrintWord loWord, p1
End Sub
---------------------------
I make ocx control and call it from below code in htm file.
-------------
<html>
<head>
<title></title>
<SCRIPT LANGUAGE="VBScript">
<!--
On Error Resume Next
Sub Print1
Dim xObj as Object
Set xObj=CreateObject ("Project1.UserControl1")
xObj.testPrint
End Sub
// -->
</SCRIPT>
</head>
<FORM name="test">
<INPUT type="BUTTON" value="Print" name="Print" onClick="Print1" >
</form>
</html>
-------------------------
I was able to open the file for a while and then I must have made some
changes and now open the document is not working. I turned on script
debugging in ie 6 and debug message is saying that Object is required. It
looks to me that something is wrong in my vba codes. But I do not know how to
invoke debugger in visual basic. I set the break point but it doesn't stop.
Any help would be appreciated.
Thanks
Daniel
----------------
Sub PrintWord(loWord As Object, printopt As String)
opt1 = printopt
If opt1 = "p" Then
If retval1 > 0 Then
loWord.Options.PrintBackground = False
loWord.PrintOut Copies = 1
End If
loWord.Application.Quit 0
Else
loWord.Visible = True
End If
End Sub
Sub testPrint()
Dim loWord As Object
Dim doc1 As Object
Dim p1 As String
Dim loSel As Object
Set loWord = CreateObject("Word.Application")
Set loWord.Visible = True
Set doc1 = loWord.Documents.Open("C:\work\test1.doc")
Set loSel = loWord.Selection
p1 = ""
PrintWord loWord, p1
End Sub
---------------------------
I make ocx control and call it from below code in htm file.
-------------
<html>
<head>
<title></title>
<SCRIPT LANGUAGE="VBScript">
<!--
On Error Resume Next
Sub Print1
Dim xObj as Object
Set xObj=CreateObject ("Project1.UserControl1")
xObj.testPrint
End Sub
// -->
</SCRIPT>
</head>
<FORM name="test">
<INPUT type="BUTTON" value="Print" name="Print" onClick="Print1" >
</form>
</html>
-------------------------
I was able to open the file for a while and then I must have made some
changes and now open the document is not working. I turned on script
debugging in ie 6 and debug message is saying that Object is required. It
looks to me that something is wrong in my vba codes. But I do not know how to
invoke debugger in visual basic. I set the break point but it doesn't stop.
Any help would be appreciated.
Thanks
Daniel