• Dealing with form modal (O2K)

    Author
    Topic
    #405612

    I’m running VBA code in Word and would like to press enter when a wizard pops up but of course the code is suspended until the pop up is dealt with. Is there any way I can get, say, SendKeys “{ENTER}” to work on the pop up from the original code?
    Thanks.

    Viewing 1 reply thread
    Author
    Replies
    • #834774

      If you call the wizard in your code, you can insert a SendKeys line immediately above the instruction that activates the wizard. If the wizard is avtivated another way, I don’t think you can intercept it, but perhaps you can explain how this happens.

      • #834966

        Hans
        What I’m trying to do is automate the MS Fax. I can get as far as print on the fax and at this point the Send Fax Wizard pops up. I don’t know the code for manipulating fax from office so if I could get sndkeys to work that would do. This is my code so far:
        Sub SendtoFax()
        Dim strStyle(3) As String, strText(3) As String, x As Long

        strStyle(1) = “Company”
        strStyle(2) = “FaxNum”
        strStyle(3) = “Subject”
        Dim strTitle As String
        For x = 1 To 3
        Selection.HomeKey unit:=wdStory
        Selection.Find.ClearFormatting
        Selection.Find.Style = ActiveDocument.Styles(strStyle(x))
        With Selection.Find
        .Text = “”
        .Forward = True
        .Wrap = wdFindStop
        End With
        Selection.Find.Execute
        If Selection.Find.Found = True Then strText(x) = Selection
        Next x
        ‘MsgBox strText(1) & ” ” & strText(2) & ” ” & strText(3) – test line
        strTitle = ActiveDocument.Path & “” & ActiveDocument.Name
        Printon “Fax”
        ….. at this point Wizard

        (Printon() is my own func for changing printer then reverting to default). I’ve tried automation with FAXCOMLib.dll but I can’t get it to recognise the fax server either.

        I’d appreciate more of your wisdom. Thanks.

        • #835004

          Have you actually tried the SendKeys instruction before the line that calls the wizard?

          • #835125

            I’ve worked out FaxCom.dll so I’ve got it to work properly now thanks, Hans. It was actually pretty straightforward once I got my head round FaxComLib Classes and Properties.

            Thanks again. (If anyone wants to see the code I’ll happily post it)

          • #835126

            I’ve worked out FaxCom.dll so I’ve got it to work properly now thanks, Hans. It was actually pretty straightforward once I got my head round FaxComLib Classes and Properties.

            Thanks again. (If anyone wants to see the code I’ll happily post it)

        • #835005

          Have you actually tried the SendKeys instruction before the line that calls the wizard?

      • #834967

        Hans
        What I’m trying to do is automate the MS Fax. I can get as far as print on the fax and at this point the Send Fax Wizard pops up. I don’t know the code for manipulating fax from office so if I could get sndkeys to work that would do. This is my code so far:
        Sub SendtoFax()
        Dim strStyle(3) As String, strText(3) As String, x As Long

        strStyle(1) = “Company”
        strStyle(2) = “FaxNum”
        strStyle(3) = “Subject”
        Dim strTitle As String
        For x = 1 To 3
        Selection.HomeKey unit:=wdStory
        Selection.Find.ClearFormatting
        Selection.Find.Style = ActiveDocument.Styles(strStyle(x))
        With Selection.Find
        .Text = “”
        .Forward = True
        .Wrap = wdFindStop
        End With
        Selection.Find.Execute
        If Selection.Find.Found = True Then strText(x) = Selection
        Next x
        ‘MsgBox strText(1) & ” ” & strText(2) & ” ” & strText(3) – test line
        strTitle = ActiveDocument.Path & “” & ActiveDocument.Name
        Printon “Fax”
        ….. at this point Wizard

        (Printon() is my own func for changing printer then reverting to default). I’ve tried automation with FAXCOMLib.dll but I can’t get it to recognise the fax server either.

        I’d appreciate more of your wisdom. Thanks.

    • #834775

      If you call the wizard in your code, you can insert a SendKeys line immediately above the instruction that activates the wizard. If the wizard is avtivated another way, I don’t think you can intercept it, but perhaps you can explain how this happens.

    Viewing 1 reply thread
    Reply To: Dealing with form modal (O2K)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: