Results 1 to 7 of 7

Thread: Component Request Pending

  1. #1

    Thread Starter
    New Member
    Join Date
    Sep 2000
    Posts
    1

    Question

    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


  2. #2
    New Member
    Join Date
    Jul 2001
    Location
    CBB
    Posts
    10

    Red face 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

  3. #3
    -= B u g S l a y e r =- peet's Avatar
    Join Date
    Aug 2000
    Posts
    9,629
    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 ?
    -= a peet post =-

  4. #4
    New Member
    Join Date
    Jul 2001
    Location
    CBB
    Posts
    10

    Exclamation The story

    Perhaps if I tell you the whole story

    The following code searches withing files:

    sDir = "\\BDS_SERVER\Dave\Dave\New CD-COB\" & vol

    sSearchfor = Text1.Text
    If sSearchfor = "" Then Exit Sub

    If objWord Is Nothing Then
    Set objWord = CreateObject("Word.Application")
    Else
    Set objWord = GetObject(, "Word.Application")
    End If

    With objWord.FileSearch
    .NewSearch
    .LookIn = sDir
    .SearchSubFolders = True
    .MatchTextExactly = False
    .TextOrProperty = "*" & sSearchfor & "*"
    .FileType = msoFileTypeAllFiles

    If .Execute() > 0 Then
    StatusBar1.SimpleText = "There were " & .FoundFiles.Count & " file(s) found that match your criteria."
    Text2.Visible = False
    For i = 1 To .FoundFiles.Count
    List1.List(i - 1) = .FoundFiles(i)
    Next i

    Else
    MsgBox "There were no files found."
    Text2.Visible = False
    End If
    End With

    I get the following problem. 'Component Request Pending, this action cannot be completed because the application is too busy? ....Press Switch too or Retry'

    If i hit retry it will eventually complete the file search, any ideas on how i can get the code to stop freesing everything in the window. I also need to work out a way or stopping the search is the user requests it (but thats not as important).

    I inserted messageboxes along the code and the problem seems to occur on the 'If .Execute() > 0 Then' line.

    Ive been battling with this thing for days, and im kinda sick of the sight of it!

    Many thanks in advance

    Desperado ' REMEMBER ME ' Dave

  5. #5
    New Member
    Join Date
    Jul 2001
    Location
    CBB
    Posts
    10

    Unhappy 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

  6. #6
    -= B u g S l a y e r =- peet's Avatar
    Join Date
    Aug 2000
    Posts
    9,629
    VB Code:
    1. '----------------------------------------
    2. '- Name:    peet
    3. '- Email:   [email][email protected][/email]
    4. '- Web:
    5. '- Company: PvP
    6. '----------------------------------------
    7. '- Notes:  
    8. '- Sample to show how to search a word-
    9. '  document using automation
    10. '      
    11. '----------------------------------------
    12.  
    13. Private objWord As Word.Application
    14. Private wd As Word.Document
    15.  
    16. Private Sub Command1_Click()
    17.     Dim myRange As Range
    18.     Dim sSearchfor As String
    19.     sSearchfor = InputBox("What do u want to search for?")
    20.     If sSearchfor = "" Then Exit Sub
    21.    
    22.     If objWord Is Nothing Then
    23.         Set objWord = CreateObject("Word.Application")
    24.     Else
    25.         Set objWord = GetObject(, "Word.Application")
    26.     End If
    27.     DoEvents
    28.     Set wd = objWord.Documents.Open("c:\Test.doc")
    29.    
    30.     Set myRange = wd.Content
    31.     myRange.Find.Execute FindText:=sSearchfor, Forward:=True
    32.     If myRange.Find.Found Then
    33.         MsgBox "The document contains :'" & sSearchfor & "'", vbInformation
    34.     Else
    35.         MsgBox "The document do NOT contain'" & sSearchfor & "'", vbInformation
    36.     End If
    37.    
    38.     If Not (wd Is Nothing) Then Set wd = Nothing
    39.     If Not (objWord Is Nothing) Then objWord.Application.Quit
    40.     If Not (objWord Is Nothing) Then Set objWord = Nothing
    41.  
    42. 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.
    -= a peet post =-

  7. #7
    New Member
    Join Date
    Jul 2001
    Location
    CBB
    Posts
    10

    Cool 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
  •  



Click Here to Expand Forum to Full Width