Solved

Printing in Excel via VB6.0

Posted on 2000-04-04
6
291 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
[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
  • 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
Technology Partners: 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!

 

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

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
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…
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
Course of the Month11 days, 8 hours left to enroll

623 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