Solved

for MCRIDER :))

Posted on 2000-02-24
1
178 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
VBA Excel: fill / replace values based on a config sheet. 5 61
vba find the last empty column 10 90
Updates not working for MS Windows 7 12 154
VB6 ListBox Question 4 34
Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
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 utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

863 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

24 Experts available now in Live!

Get 1:1 Help Now