Solved

Printing in Excel via VB6.0

Posted on 2000-04-04
6
290 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
Revamp Your Training Process

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

 

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

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!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Saving history changes to sub form 4 56
Microsoft Access combo box help 2 57
VB6 - Compare and highlight cell not the same 3 62
Add a task in Outlook from access 11 43
Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…

739 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