Solved

for MCRIDER :))

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

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

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

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

707 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