Solved

Printing in Excel via VB6.0

Posted on 2000-04-04
6
287 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 AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

 

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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
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…
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…
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…

810 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