Solved

Printing in Excel via VB6.0

Posted on 2000-04-04
6
286 Views
Last Modified: 2010-05-02
Here's my problem....  

* Main *
Call Checkreport (.....)

Public Sub Checkreport (...)
 ' does a bunch of things to get workbook and worksheet information
  Call ReportPrint 't print excel reports
End Sub

Public Sub ReportPrint (....)
  'uses Create Object to open an instance of Excel
  ' it prints the excel worksheet (specific one from a workbook)
  ' then closes the excel instance and relese all objects
End Sub

The CheckReport subroutine loops through a file to collect filenames
for printing so each file it finds, it send to ReportPrint to print the file.

The Problem:
  When I run it,it has no problems printing the first file, but then it doesn't print any other files after that!!!  I think it goes through too fast for excel to process...  what can I do to fix the problem... how can I force the program to wait for the excel to close/quit before sending the nex printjob???  Is there a better way to approachthe problem??

I hope I made the question clear... pleas let me know if more clarification is needed...

Thanks,
Trieu Nguyen
Azurix North America
0
Comment
Question by:Trieu
  • 4
  • 2
6 Comments
 
LVL 28

Expert Comment

by:AzraSound
ID: 2686112
have you tried using a doevents in between the print command and the closing of the excel application?
0
 

Author Comment

by:Trieu
ID: 2686118
Yep I have... but it doesn't do anything... still goes through too fast.
0
 
LVL 28

Accepted Solution

by:
AzraSound earned 200 total points
ID: 2686129
0
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.

 

Author Comment

by:Trieu
ID: 2686986
Those appear to be getting information through a Shell() or commandline... When I call Excel I use the "CeateObject" method to open Excel and print the files.
0
 

Author Comment

by:Trieu
ID: 2687352
Never mind I figured it out, using the Window Handler.  I just created a subfunction that searches for an instance of Excel to be open and then wait until it closes...  but I appreciate your help and although the duocuments did not give me the answers, it did steer me in the right direction, so the points are yours!!!

Trieu Nguyen
Azurx North America
0
 

Author Comment

by:Trieu
ID: 2687356
Never mind I figured it out, using the Window Handler.  I just created a subfunction that searches for an instance of Excel to be open and then wait until it closes...  but I appreciate your help and although the duocuments did not give me the answers, it did steer me in the right direction, so the points are yours!!!

Trieu Nguyen
Azurix North America
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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
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…
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…

930 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

14 Experts available now in Live!

Get 1:1 Help Now