|
-
Sep 6th, 2000, 01:16 PM
#1
Thread Starter
New Member
In my program, I call the excel application to perform a long operation task upon responding to a click onto a command buton. I like to know how do I by pass the display of the Component Request Pending dialog and raise an error trap in responding to the mouse clicks, or a keypress. In another word, my purpose is after clicking the button to perform the excel job, if somehow the user click the cancel button or escape key, i could be able to stop the program or pausing it. Any suggestion will be a big help. Thanks
-
Aug 5th, 2001, 11:19 PM
#2
New Member
Thats a good question
Ive got the same problem, hey vbmember, if i find out ill let you know somehow, ok.
Hey...Somebody help US!!!
Dave
-
Aug 5th, 2001, 11:34 PM
#3
-= B u g S l a y e r =-
You have a form with a launch button and a cancel button, and all manipulation of the excel spreadsheet is done inside u'r vb app ?
-
Aug 6th, 2001, 04:46 AM
#4
New Member
-
Aug 7th, 2001, 05:05 AM
#5
New Member
Different Code
Perhaps i should just look for different search code? Shame seeing as it took me days to get this piece! Ideas are welcome as i am lost.
Thanks
DAVE
-
Aug 7th, 2001, 05:09 AM
#6
-= B u g S l a y e r =-
VB Code:
'----------------------------------------
'- Name: peet
'- Web:
'- Company: PvP
'----------------------------------------
'- Notes:
'- Sample to show how to search a word-
' document using automation
'
'----------------------------------------
Private objWord As Word.Application
Private wd As Word.Document
Private Sub Command1_Click()
Dim myRange As Range
Dim sSearchfor As String
sSearchfor = InputBox("What do u want to search for?")
If sSearchfor = "" Then Exit Sub
If objWord Is Nothing Then
Set objWord = CreateObject("Word.Application")
Else
Set objWord = GetObject(, "Word.Application")
End If
DoEvents
Set wd = objWord.Documents.Open("c:\Test.doc")
Set myRange = wd.Content
myRange.Find.Execute FindText:=sSearchfor, Forward:=True
If myRange.Find.Found Then
MsgBox "The document contains :'" & sSearchfor & "'", vbInformation
Else
MsgBox "The document do NOT contain'" & sSearchfor & "'", vbInformation
End If
If Not (wd Is Nothing) Then Set wd = Nothing
If Not (objWord Is Nothing) Then objWord.Application.Quit
If Not (objWord Is Nothing) Then Set objWord = Nothing
End Sub
This sample is a bit slower than the solution u had, but it will give u a better control over the code.
The problem with using .Execute is that u can not interrupt it...
Play around with the code above. Hope it can get u onto the right track.
-
Aug 20th, 2001, 02:13 AM
#7
New Member
Thanks
Yes it does remove the .execute problem, ill have to give it more thought, Thanks Peet!
P.S sorry it took me so long to reply
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
|