|
-
Jul 9th, 2002, 05:26 AM
#1
Thread Starter
New Member
OLE Ms Word
Hello,
I have started programming vb6 about a month ago and i have runin to a little bit of a problem. I want to open Ms Word with a new document and setup this document through my vb6 program. The first time vb6 opens Ms Word there is are no errors and Word is started, but when Ms Word is closed and i run the code for the second time i get this error message:
RUN TIME ERROR the remote machine does not exits or is unavailable.
Thanx for your time !,
This is the code:
Public objWord As Word.Application
Private Sub cmdStart_Click()
Dim range1 As Range
Dim DocNaam As String
Dim DezeDoc As Document
Set objWord = new Word.Application
objWord.Visible=True
With objWord
.documents.Add
DocNaam = .ActiveDocument.Name
set DezeDoc = .Documents(DocNaam)
set range1 = DezeDoc.Range
range1.InsertAfter "test"
range1.PageSetup.Topmargin = CentimetersToPoints (3.5)
End With
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|