Solved

for MCRIDER :))

Posted on 2000-02-24
1
177 Views
Last Modified: 2010-05-02
Hi mate it's Chaz again :))

Do u remember when i asked you how to make always on top??

Cool, the problem i have is after sending my document to the fax it doesn't make the form lose focus....ummmm here's the code to help me explain what i mean:

Dim ir As Long
        ir = SetTopMostWindow(Form1.hwnd, True)

On Error GoTo errorhandler
   Dim x As Printer
       For Each x In Printers
           If x.DeviceName = "ElectraSoft Print to Fax" Then
               Set Printer = x
               Exit For
           End If
       Next
       formprint.SendToPrinter Form1, Landscape
   Printer.EndDoc
   Exit Sub 'THIS LINE WAS MISSING IN YOUR CODE
Dim pq As Long
         pq = SetTopMostWindow(Form1.hwnd, False)
         Form2.SetFocus
errorhandler:
   MsgBox "There was an error sending the fax!", vbCritical, "Error!"

I hope this helps to eplain what i mean....
0
Comment
Question by:chazter
1 Comment
 
LVL 14

Accepted Solution

by:
mcrider earned 20 total points
ID: 2556632
Hey Chaz!

The problem is that the "SetTopMostWindow...False" statement is not executing because you put it after the "Exit Sub" statement...

It should look like this:

    Dim ir As Long
    Dim pq As Long
    ir = SetTopMostWindow(Form1.hwnd, True)

    On Error GoTo errorhandler
    Dim x As Printer
    For Each x In Printers
        If x.DeviceName = "ElectraSoft Print to Fax" Then
            Set Printer = x
            Exit For
        End If
    Next
    formprint.SendToPrinter Form1, Landscape
    Printer.EndDoc
    pq = SetTopMostWindow(Form1.hwnd, False)
    Form2.SetFocus
    Exit Sub 'THIS LINE WAS MISSING IN YOUR CODE
   
errorhandler:
   MsgBox "There was an error sending the fax!", vbCritical, "Error!"



Cheers!

0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now