Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 22158

Stuck With Visual Basic 6.0

$
0
0
I am a newbie, what I want to do is open a word document and do some find actions from Text1, but when I click the commandButton in second time, there is no action with the commandButton
here is my code :

Code:

Dim doc As Word.Application
Dim val As Boolean

Private Sub Command1_Click()
    If val <> True Then
        Set doc = New Word.Application
        doc.Visible = True
       
        doc.Documents.Open "\..\myDoc.doc"
       
        doc.Selection.Find.Execute Text1.Text
        val = True
    ElseIf val = True Then
        doc.Selection.Find.Execute Text1.Text
    End If
End Sub


Could you give me the solutions please ?

Viewing all articles
Browse latest Browse all 22158

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>