Vb6 and Word working fine on one machine but not on other 
Author Message
 Vb6 and Word working fine on one machine but not on other

Hi People
any suggestions for a little problem

re:Vb6 and Word working fine on one machine but not on other

I have Two machines running Windows 98,VB6, both with word8.olb in fact both
are identical even the project References.
one Machine (stand alone) runs the following code Fine
The other (on Network) wont fire up the word aplication.
 Does anybody know why ?
regards
john roy

====================================================================
Private Sub cmdLetter_Click()
Dim vName As String
Dim vFilename1 As String
Dim oApp As Word.Application

 vFilename1 = LetterPath & "\CustomerLetterFormula.doc"

On Error Resume Next
Set oApp = GetObject(, "Word.Application")
'Get the running instance of Word, if there is no instance
'create a new one:
If Err.Number <> 0 Then
Set oApp = CreateObject("Word.Application")
End If

oApp.Activate
oApp.Visible = True
oApp.WindowState = wdWindowStateMaximize
'New document
oApp.Documents.Open Filename:=vFilename1

    With oApp.ActiveDocument
     .FormFields("OurRef").Result = vLetterNumber
        .FormFields("Text1").Result = pvEnquiry.EnqContact
        .FormFields("Text2").Result = pvEnquiry.EnqPremises
        .FormFields("Text3").Result = pvEnquiry.EnqStreet
        .FormFields("Text4").Result = pvEnquiry.EnqTown
        .FormFields("Text5").Result = pvEnquiry.EnqCounty
        .FormFields("Text6").Result = pvEnquiry.EnqPostCode

        .FormFields("Text7").Result = pvEnquiry.EnqContact

    End With

oApp.ActiveDocument.SaveAs Filename:=vFilename2
oApp.ActiveDocument.Protect Type:=wdNoProtection, Password:="free"

'oApp.ActiveDocument.PrintOut
oApp.ActiveDocument.Close

Set oApp = Nothing

End Sub



Fri, 09 May 2003 03:00:00 GMT  
 Vb6 and Word working fine on one machine but not on other
Hi John,

You probably checked this, but nevertheless:

Has the other mashine got VBRun 6 running?

You could also try to use Set oApp = new Word.Application to launch Word.

Hope this helps,

Jasper Mandos.
______________________

Microsoft newsgroups:

Knowledgebase:
http://search.support.microsoft.com/kb/c.asp

MSDN:
http://msdn.microsoft.com/default.asp



Quote:
> Hi People
> any suggestions for a little problem

> re:Vb6 and Word working fine on one machine but not on other

> I have Two machines running Windows 98,VB6, both with word8.olb in fact
both
> are identical even the project References.
> one Machine (stand alone) runs the following code Fine
> The other (on Network) wont fire up the word aplication.
>  Does anybody know why ?
> regards
> john roy

> ====================================================================
> Private Sub cmdLetter_Click()
> Dim vName As String
> Dim vFilename1 As String
> Dim oApp As Word.Application

>  vFilename1 = LetterPath & "\CustomerLetterFormula.doc"

> On Error Resume Next
> Set oApp = GetObject(, "Word.Application")
> 'Get the running instance of Word, if there is no instance
> 'create a new one:
> If Err.Number <> 0 Then
> Set oApp = CreateObject("Word.Application")
> End If

> oApp.Activate
> oApp.Visible = True
> oApp.WindowState = wdWindowStateMaximize
> 'New document
> oApp.Documents.Open Filename:=vFilename1

>     With oApp.ActiveDocument
>      .FormFields("OurRef").Result = vLetterNumber
>         .FormFields("Text1").Result = pvEnquiry.EnqContact
>         .FormFields("Text2").Result = pvEnquiry.EnqPremises
>         .FormFields("Text3").Result = pvEnquiry.EnqStreet
>         .FormFields("Text4").Result = pvEnquiry.EnqTown
>         .FormFields("Text5").Result = pvEnquiry.EnqCounty
>         .FormFields("Text6").Result = pvEnquiry.EnqPostCode

>         .FormFields("Text7").Result = pvEnquiry.EnqContact

>     End With

> oApp.ActiveDocument.SaveAs Filename:=vFilename2
> oApp.ActiveDocument.Protect Type:=wdNoProtection, Password:="free"

> 'oApp.ActiveDocument.PrintOut
> oApp.ActiveDocument.Close

> Set oApp = Nothing

> End Sub



Fri, 09 May 2003 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Vb6 and Word working fine on one machine but not on other

2. Error 3071...Why on one machine and not on others

3. Excel file opened in IE3 - on one machine starts Excel, others does not

4. Error Win 95 Machines Using VB (Works Fine on NT Machines)

5. Procedure working on some machines and not others

6. FileSystemObject: works on some machines, others not

7. FileSystemObject: works on some machines, others not

8. VB6 with ADO works fine on W2k not on Win NT4

9. Problem for only one user, every one else works fine

10. Com Addin Work Fine on My Machine but...

11. Macro Works One Machine Not Another

12. DBGrid Delete Key function not working on some DBGrids while it works on others

 

 
Powered by phpBB® Forum Software