?
Solved

for MCRIDER :))

Posted on 2000-02-24
1
Medium Priority
?
186 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 80 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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.
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
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…
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…
Suggested Courses

777 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