Solved

Printing in Excel via VB6.0

Posted on 2000-04-04
6
285 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
Comment Utility
have you tried using a doevents in between the print command and the closing of the excel application?
0
 

Author Comment

by:Trieu
Comment Utility
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
Comment Utility
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Comment

by:Trieu
Comment Utility
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
Comment Utility
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
Comment Utility
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
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…
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…

743 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

13 Experts available now in Live!

Get 1:1 Help Now