Solved

for MCRIDER :))

Posted on 2000-02-24
1
182 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

732 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