Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  HOME    TRACKER    Visual Basic

Printing Multiple Pdf Documents..

I'm trying to use the pdf.ocx to print a large number of pdf documents, using a loop, but the files does not seem to registered in the printer spooler. This results in only the last document beeing printed(!?) (In the sample code: test3.pdf)

for i = 0 to 3
pdf1.LoadFile ""
pdf1.LoadFile "test" & format$(i) & ".pdf"
pdf1.printPagesFit 1, 1, False

(I would very much like to stick to the printPagesFit function, because I have to suppress the default "Shrink large pages" option in the Page Handling section of the print dialogue in Acrobat - forcing the documents to be printed with the "None" option (set with the False parameter above).

Anyone who knows if this really is a bug. Or/and how to get around it?

View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Printing Multiple Documents

I am trying to print multiple documents (word, excel) in a single pass to the printer.

Now, I know you can use Shellexecute to print, but this sends the document one at a time to the printer. Is there anyway to merge the documents into one document or pause the printer spooler until you send all the print jobs then print?

Thanks in advance for anyone's help,

Problem Printing Multiple Documents
Access DataBase

I am not really sure where to put this thread since the
problem may be with the data reports and/or the multiple
sql queries.

My objective is to print multiple data reports that are not
bound to a data environment and are generated by sql
queries according to the start and end dates picked by the
user from a combo box on a form....

My form has a command button that should print all
reports when clicked, obviously. There are 22 reports

My problem is interesting. All of my reports DO PRINT.
The problem is when the button is clicked, some of the
reports generate the errors:

DataField 'cable_Network' not found and
DataField 'Newspaper' not found

It seems to be missing the data field of the first column of
every other report. When the reports appear, the ones that
had the errors are blank. But they ALL print.

Here is the code for 4 of the 22 reports:

VB Code:
Private Sub cmdPrintAll_click()cd2.Copies = 1cd2.PrinterDefault = Truecd2.ShowPrinterx = cboStartDate.Texty = cboEndDate.Text 'cable network characteristicsdb.Execute "DELETE FROM CableCharacteristics"db.Execute "insert into CableCharacteristics" & _"(Cable_Network,csTotal,csPercent,Gender,gTotal,gPercent,Vehicle,vTotal,vPercent)" & _"select Flag1,count(*),Count(*)/(SELECT count(*) from info)," & _"sex,count(*),Count(*)/(Select count(*) from info)," & _"CarNewUsed,count(*),count(*)/(Select count(*) from Info)" & _" from Info Where SurveyDate >= #" & x & "# And SurveyDate <= #" & y & _"# group by Flag1,sex,CarNewUsed"rptPrint "CableCharacteristics", rptCableNetChar, "Cable Characteristics" 'newspaperdb.Execute "Delete from Newspaper"db.Execute "insert into NewsPaper(NewsPaper,TotalSurveys,Percentage,NewspaperDay,DayTotal,DayPercent)" & _"select NewsPaper1,count(*),Count(*)/(SELECT count(*) from info)," & _"NewsPaper1d1,count(*),Count(*)/(Select count(*) from info)" & _"from info where SurveyDate >=#" & x & "# and SurveyDate <=#" & y & "#" & _"group by SurveyDate,NewsPaper1,NewsPaper1d1"rptPrint "Newspaper", rptNewsPaper, "#1 Newspaper" 'afternoonRadiodb.Execute "DELETE FROM AfternoonRadio"db.Execute "insert into AfternoonRadio(RadioName,TotalSurveys,Percentage)" & _"select Radio1Name, count(*),Count(*)/(SELECT count(*) from info) " & _"from info where FirstPicRadioTime2 = 'Late Afternoon 3-7pm' " & _"AND SurveyDate >= #" & x & "# AND SurveyDate <= #" & y & "# group by Radio1Name"rptPrint "AfternoonRadio", rptAfternoonRadio, "Afternoon Radio"'morningRadiodb.Execute "delete from MorningRadio"db.Execute "insert into MorningRadio(RadioName,TotalSurveys,Percentage)" & _"select Radio1Name, count(*),Count(*)/(SELECT count(*) from info)" & _"from info where FirstPicRadioTime1 = 'Mornings 6-10 am'" & _" and SurveyDate>=#" & x & "# and SurveyDate <=#" & y & "# group by Radio1Name"rptPrint "MorningRadio", rptMorningRadio, "Favorite Morning Radio" End Sub

Here is the function that the variables are being passed to.

VB Code:
Private Function rptPrint(TableName As String, rptName As DataReport, Heading As String) If Rs1.State = adStateOpen Then Rs1.CloseSet rptName.DataSource = Rs1Rs1.ActiveConnection = dbRs1.CursorType = adOpenDynamicRs1.CursorLocation = adUseClientRs1.LockType = adLockReadOnlyRs1.Open "Select * from " & TableNameIf Rs1.RecordCount = 0 ThenMsgBox "No Records Found"ElseWith rptName.Sections("Section4").Controls.Item("lblTitle").Caption = Heading & ":" & x & " - " & yrptName.PrintReportEnd WithEnd If End Function

Another thing that I want to do is to be able to close each
report somehow after it is printed because I do not want
the user to have to close all 22 reports after they click the
print button however, I cant seem to find a way to do this
and the .hide property does not seem to work with data

Thank you for you time.

Printing Multiple HTML-Documents Using WEbBrowser Control
Hello !

I´ve got the following problem. In a VB-Program ( Version 6 ) I need to print multiple HTML and XML-Documents.

This should happen in a loop above the desired documents ( all available on harddisk !) . But there are a lot of problems using the webbrowser control. only one object of the control is instantiated cause the loop can contain up to 10000 documents , so that an initialize of one Browser-control for each doc will soon stop the computer from doing anything.
In this loop I navigate to the doc then give the execwb OLECMDID_PRINT.. command... wait for Readystate = READYSTATE_COMPLETE close the document and walk to the next document...
But it doesn´t work. Not every document is printed or the Explorer is closed before all docs are printed or no doc is printed .... and so on..

I know that the browser creates a second process to print the doc , so I tried it with waiting 1st for the message IE_DocumentComplete and the win_onafterprint. but still the docs are not printed out correctly .
When I implement a For-NExt-Loop before processing the next doc , sometimes all docs are done well... but only sometimes.

I ´m glad to hear about any solution for this problem. I don´t prefer a solution in VB , if you know any ActiveX component that can print either HTML as XML , please tell me.

Waiting for your answers ;-))


Printing Multiple WORD Documents With A Command Button...

Does anyone know if it's possible to have a command button to print all Word documents in a certain folder? Thanks in advance!

Multiple Documents
Hi Everbody,

I'd like to be able to open several instances of my program and switch between them.

Three part question, how do I open another instance of the application? Ie if I press File>New what code do need to open another instance of program.exe?

And can I add add to the "Window" list in the file menu all open instances of the program? Like most programs do so that you can switch between them using the file menu?

And finally how would I switch between them? The chosen instance of the program brought to the front.

CTRL-TAB, can I scroll through them? I guess they have to somehow recognise each other as being the same program with different input.

Opening Multiple Documents

I have code that uses late binding to create Word documents

The code looks like this:

Sub opens

On Error Resume Next

Dim oDoc, oMSOffice As Object

Set oMSOffice = GetObject(, "Word.Application")
If Err.Number <> 0 Then
Set oMSOffice = CreateObject("Word.Application")
End If

With oMSOffice.Documents
.Open FileName:="one.doc", Visible:=False
Set oWd = .Open(FileName:="two.doc", Visible:=True)
End With

oMSOffice.Visible = True
Set oMSOffice = Nothing
End Sub

The problem I'm having, is that whenver the Word application becomes visible, the focus goes to the FIRST document opened, when the Activate call is meant to set the focus of MS Word to the LAST document opened. (i.e., in the above example, the focus should be on two.doc instead of one.doc.

Is there an extra step I'm missing?

Printing Documents
is it possible to print pdf or word documents using VB? I dont want to be able to open them or view them or anything, I just want to be able to send those documents to the printer for printing from a VB app.
Can anyone point me in the right direction?

Thanks in advance
Mike M

Printing PDF's Documents

I'm trying to print PDF Documents but i'm getting no where. Does anyone have any advice on how to perform this?


Printing DOC And PDF Documents

How can I print DOC and PDF documents from my VB6 program?
Let's say I have a program with just one button PRINT. When the user clicks on it, it should print the following documents:


How do I do that?

Printing Documents
Hi guys!

My goal is as follows:
I have a *.txt fil that contains several names of documents.
for example:

all these documents are located on my c:documents folder.

The question is as follows:
How can I make an application that reads the txt file, and automatically prints these documents on my default printer??

All suggestions appreciated!!
Thanks in advance.

Printing Pdf Documents
Hi can anybody help please?

In windows explorer, if you right click on a pdf and select print from the context menu, it will print to the default printer without opening Adobe Reader. Does anybody know how to do this progmatically, i.e. is there an API which will do this?


Printing Documents In Vb
Ok i need an opinion.

I have a few documents that I would like the users to be able to print in my application. What I want to do is have a form that lists all the files from a folder (in a listbox) and have the user be able select an item from the list and print it. I figured out the listbox part, now it's just a matter of figuring out what kind of documents to use and how to print them

The documents I have do not need any fields edited, they are just general generic documents that need to be printed every once in a while.

What would you guys suggest. I looked into printing Word Documents (.doc), but it loads the MS Word gui first before opening the print dialog which I want to avoid. I would prefer it just show a print dialog or better yet just print to the default printer.

Does anyone have any suggestions??

Printing Documents
Hi all
Ive been looking around now for some time on how to print documents with vb6.
Some of the problems Im having are these.

I have this code that ive been using to print documents with word launching evry time i need a doc printed. Now in the beggining that wasnt too bad an idea, now its getting a dragg waiting for word to load up and stuff.
Now I ve been looking around for a way to print with out word launching and for that matter not having to install word at all. (Cause as some of you may know the code that im going to post can not be used if word is not installed)

Now the other way i know of printing docs is

VB Code:
Printer.Print "something..."Printer.EndDoc

The problem with the above is that it prints the files source code not what i need Because I need to print documents that have tables images and stuff.

Now what im wondering before i keep searching for a another way. Can I print word, exel etc documents without having MS office installed at all?

And if not, then Ill have to stick with the method im using now
Heres how im printing documents at the moment

VB Code:
Sub PrintDocs()     'PROMTPS USER TO PRINT    If MsgBox("Would you like to print this document?", vbYesNo) = vbNo Then        Exit Sub    End If  If objWord Is Nothing Then        Set objWord = CreateObject("Word.Application")    Else        Set objWord = GetObject(, "Word.Application")    End If        Set worddoc = objWord.Documents.Open(App.Path & FileName)    'objWord.Application.Dialogs(wdDialogFilePrint).Show        worddoc.PrintOut        'While objWord.Application.BackgroundPrintingStatus > 0    '    DoEvents    '    DoEvents    '    DoEvents    '    DoEvents    '    DoEvents    '    DoEvents    '    DoEvents    'Wend        If Not (worddoc Is Nothing) Then worddoc.Close    If Not (worddoc Is Nothing) Then Set worddoc = Nothing    If Not (objWord Is Nothing) Then objWord.Application.Quit    If Not (objWord Is Nothing) Then Set objWord = Nothing     Kill App.Path & FileName End Sub

Any suggestions?

Printing Documents Thru VB 6 App.
Hi All,

I have a doubt/problem regarding printing a text/word document from VB 6

I am able to show Printer dialog box but how to specify the document name.

I am novice in VB, so code examples would be appreciated.

Thanks a lot.


Mihir S.

How Can I Print Multiple Documents On Top Of The Same Page?
Hi Friends,

I'd like to know how to print two or more documents (like receipts or subscription forms) on top of a same page, each of them showing different data.

Thanks in advance.

Fernando A. Santos.

Inserting Multiple Documents Into Word
I have been trying to insert multiple word documents into one word document.

I have tried several diffrent approaches but always get the same error when compiling 'Expected Function or variable'. I have the Word 11.0 object model referenced so what am i doing wrong.

I set VBInstance to be word application in a class module of the Comm-Addin I am creating

Public Function OpenInsert(myDoc as String)

OpenInsert = VBInstance.Selection.InsertFile(myDoc)

End Function

I have also tried

Public Function OpenInsert(myDoc as String)
Dim myDocument as Document

Set myDocument = VBInstance.ActiveDocument

OpenInsert = myDocument.Range.InsertFile(myDoc)

End Function

I have tried other variations but with no success loosing the will to live, please help


Printing HTML Documents.
Ok.. Here goes..
We are using StarOffice to generate HTML documents.
Using the header and footer options on the pages, Star Office previews and prints the pages correctly.. i.e. With the header and footer on EACH page.

When viewed in the WebBrowser control, however, the tags seem to be completely ignored, and the header and footer are printed as parts of the whole document... i.e. The header is at the TOP of the 1st page, and the footer is at the end of the x page, not on every page, as is represented by StarOffice.

Using a DLL Spy, i can see that StarOffice is using MSHTML.DLL

Is this the DLL that allows StarOffice to use the Header / Footer information?

Here is a snippit of the HTML code being used.

&lt;COL WIDTH=181*&gt;
&lt;COL WIDTH=75*&gt;
.... etc etc etc


..... etc etc etc..

Any help would be greatly apperciated.

Printing Word Documents
Hi guys, I have a program printing set of word documents (separate files) in a loop, funny thing happens in the print spooler, although the documents are in order, the last document goes into the queue starts printing before the first one. Any one knows any api calls to get a feedback from the print spooler so that I can get the program to wait until a document is spooled and printing before issuing another print. Greatly appreciated.

Printing MSWord Documents From VBA
I have generated some MSWord documents, and know how to print them from my VBA code, but I would like to be able to set certain print options automatically for certain documents, such as printing in full duplex (my printer can print to both sides) and specifying which pages to print. How do I do these in VBA code, and is there a guide somewhere that lists all the available printer commands?

Printing Several Word Documents
I'd like to write a VB program which will print all MS Word documents in a
specified folder and then move the documents into another folder.

I'm new to VB so am struggling with the printing part.
This is a rough idea of what I'm thinking...

Private Sub Button_Click()
Dim myDoc As Object

ChDir ("c estgenerated")

myFile = Dir("c estgenerated")
While myFile <> ""
myFile = Dir
myDoc.Name.Value = myFile

' Send the document to a specified printer
' move the document to "c: estprinted

End Sub

I've come across the functions OpenPrinter and StartDocPrinter but not
really sure how to use them.

Any ideas welcome.

thanks, Cath

***** DISCLAIMER ***** This communication contains information which is
confidential. It is for the exclusive use of the intended recipient. If you
are not the intended recipient, please note that any distribution, copying
or use of this communication or the information in it is prohibited. If you
have received this communication in error, please notify us by email or by
telephone on 0151 653 1700 and then delete the email and any copies of it.

Trouble Saving Multiple Excel Documents- Please Help

I have this program that I collect data for service call and when I'm done. I save files as .xls but separate the reports from the invoice. On this specific page. I click "Save" to save the report and another button to save invoice. They will not work one after another, either or but not after each other. I know it's has to be a simple mistake but I'm stumped. Here's the code.

Private Sub InvoiceSave_Click()


fname = Application.GetSaveAsFilename(Range("AX2").Text + " " _
+ Range("F12").Text + " " + Range("AL13").Text + " " _
+ Format(Range("AX1").Text, "yymmdd") + " Invoice", "Excel Files (*.xls), *.xls,All Files (*.*),*.*")
Loop Until fname <> ""
ActiveWorkbook.SaveAs fname

End Sub

Private Sub SaveReport_Click()

Sheets(Array("Maintenance Data Sheet", "Field Activity Report", "Extended Note")).Copy
fname = Application.GetSaveAsFilename(Range("AX2").Text + " " _
+ Range("F12").Text + " " + Range("AL13").Text + " " _
+ Format(Range("AX1").Text, "yymmdd"), "Excel Files (*.xls), *.xls,All Files (*.*),*.*")
Loop Until fname <> ""
ActiveWorkbook.SaveAs fname

End Sub

Edit by Moderator:
Please post Excel questions, in the Excel forum.

Please use the [vb][/vb] tags when you post your code. Edit or reply to this post to see how.

Thank you.

Handling Multiple MS Word Window Documents With VB 5.0
Application: I have one application,Which generates the MS word documents using word template.

Problem : If keep open any allready generated document.And running application to generate the same document.It is overwrting the data on template,so that i am changing the template when ever it happend.

Solution looking:To avoid this prblem i am trying to close the opened documents,when i run the progarmme.And this should not close the all documents which are not related to my application kept opened.

This is i am doing successfully with fallowing piece of code.

i = objword.Documents.count
For i = 1 To i
s = objword.Documents(i).Name
s = Mid(s, 1, 3)
If s = "CA_" Or s = "SCA" Or s = "CCA" Or s = "CR_" Or s = "CCR" Then
objword.Documents(i).Close SaveChanges:=wdDoNotSaveChanges
End If
Next i

My application related documents are start with CA_ or SCA like that.So i am handling like above.

It is working if kept open a single insatance of window and which inturns having mulitple documents.

But it is failing when i kept open multiple insatnces of MS word and those inturn contains multiple documents.

In nutshall i want to go thorugh multiple windows of ward which are kept open and to close the documents which are related to my application,to avoid currepting my template.

Could any body give solution for this

Thanks in advance

Search Texts In Multiple Word Documents
Hi I need to search texts in multiple word documents....I did post a thread previously and got this post by The182guy...

Here we are searching dates with search criteria "2005" and extracting the left hand side six digits along with "2005" to get full date, the code is working absolutely fine if the dates are in consequetive lines, i mean if the search criteria (here 2005) is in 1st, 2nd, 3rd, and so on..... but if the date is in 1st, and 3rd but not in 2nd extracts only date in the first line....Also, how we can get certain characters from right hand side of search criteria as here we are extracting first six characters from left hand side of the search criteria to get the full date....Thanks
VB Code:
Private Sub cmdGo_Click()Dim lngFileLength As LongDim strContents As StringDim intFreeFile As IntegerDim a As IntegerDim lngFileCount As LongDim strFilename As StringDim strFolderPath As StringDim lngChunkLocation As LongDim strDatesChunk As String On Error GoTo ErrorTrap 'Check if the user has put a final backslash at the end of the foldertextboxIf Right(strFolderPath, 1) = "" Then    strFolderPath = Left(txtFolder.Text, Len(txtFolder.Text) - 1)Else    strFolderPath = txtFolder.TextEnd If 'Set the file list's path to the textbox pathfleList.Path = strFolderPath 'Begin looping through each file in the file listFor lngFileCount = 0 To fleList.ListCount - 1     intFreeFile = FreeFile 'Find a free file number        'There may be none word doc files in the folder, this loop checks if its a word doc, if  not, go to the next file and check    While Not Right(fleList.List(lngFileCount), 4) = ".doc"        lngFileCount = lngFileCount + 1    Wend        'Set the filename which we will use when reading the file    strFilename = strFolderPath & "" & fleList.List(lngFileCount)     'Read file contents into strContents$ string    Open strFilename For Binary Access Read As #intFreeFile        lngFileLength = LOF(intFreeFile)        strContents$ = Space(lngFileLength)        Get #intFreeFile, , strContents$    Close #intFreeFile 'Close the file     'Read the dates chunk e.g 03/02/2005 03/05/2005 01/01/2005    'In the chunk they are seperated by new lines    lngChunkLocation = InStr(strContents$, "2005") 'Get the number location of the start of the  chunk        'Store the chunk of dates in strDatesChunk    strDatesChunk = Split(Mid(strContents$, lngChunkLocation - 6), vbCrLf & vbCrLf)(0)        'Pass the chunk of dates (and the filetitle), to the ParseChunk function, which will pick  out each date and add it to list1    a = ParseChunk(strDatesChunk, fleList.List(lngFileCount)) Next lngFileCount 'Begin the next file Exit Sub 'Exit sub here because if an error did not occur, we dont want to run the trap below 'If an error, it runs thisErrorTrap:If Not Err.Number = 9 Then 'If the error is SubScript Out Of Range, ignore, otherwise show  messagebox error    MsgBox "Error (" & Err.Number & "): " & Err.Description, vbCritical, "Error"End IfEnd Sub Public Function ParseChunk(strDates As String, strFileTitle As String)Dim i As LongDim strSingleDate As String i = 0 'Add the item to the list which says what file the dates came fromList1.AddItem "---Dates From: " & strFileTitle & " ---" Do    strDate = Split(strDates, Mid(strDates, 11, 1))(i) 'Pick out the date    'Check if it is a valid date (if theres a backslash)    If InStr(strDate, "/") Then        'Add the item to list        List1.AddItem strDate    Else        'If its not a valid date, we must be at the end of the list, so exit the do        Exit Do    End If    i = i + 1Loop While 1 = 1 Exit Function 'Same as Exit Sub above 'Same as other error trapErrorTrap:If Not Err.Number = 9 Then    MsgBox "Error (" & Err.Number & "): " & Err.Description, vbCritical, "Error"End IfEnd Function

Using Userform To Add Data To Multiple Word Documents
I have a number of word documents which are updated with data (company name,dates etc.) and then saved as a copy of the original.

I am looking for the best method to prompt user for the date, then open each word document, populate the required fields (using bookmarks) and save a copy.
I have created a userform to collect the data, but  now need to open each word document and populate the required fields(bookmarks). Any ideas on how this can be done in vba.

Printing From Excel {word Documents}
i have an excel vba code that i want to improve on. i think there are still too many things i'm doing manually after running the vba.

basically, the code is an algorithm that computes what's going to be printed in a mail merge document in word. it saves the mail merge data into a separate worksheet which i use with the word mail merge document.

is there a way i can do the printing straight from excel so i don't have to go to word each time i have to print. i'm printing around 30k - 50k pages a day, and it's getting really tedious.

the thing i'm worried about is the positioning of the print, it has to be done quite precisely because i'm printing variable data into pre-printed form letters.

also, is there a way i can automatically split up the job between several printers? right now, i do this manually, which is why things are getting tedious.

sample code would be very much appreciated.

[Still Unresolved]How To Search Text In Multiple Word Documents
i want to search text in more than one word document (without opening it) in a single folder....

I have 10 word files in a folder. This all are letters to be send to a third party having different date.
for e.g.
10/10/2005 and so on ...

i want to search "2005" and extract also the first six characters before "2005" so that i can get a list of the dates from different word documents....

Any help will be greatly appreciated.. Thank you.

Closing Multiple Open Documents From Word Templates
If I run a macro that opens a document (Doc 1) from a Word template and then opens a second Word document (Doc 2) from another template, I cannot seem to close Doc 1.

If I use ActiveDocument.close, Doc 2 closes and Doc 1 remains open.

I am not sure where to place the code to close Doc 1 and when.

Any help would be appreciated.


Edited by - NETJ on 9/18/2007 5:24:36 PM

Appending Multiple Documents/templates Within A Word Document
I am trying to generate a report (using Word) from VB that uses a template as many times as necessary. In my case, a hospital procedure can be performed multiple times on a patient, and the report generated should be able to contain sub reports that display each procedure's results. How is this done using the Document object? If others have done this another way, please let me know. Thanks!

Need Help Coding A Print/Collate Program For Multiple Office Documents
Here is my problem.

I need to print huge numbers of files (200's) and they are a mixture of excel and powerpoints. What I am wanting to do is write the VB code to make a print bach of some sorts that will collate them. So i dont have to spend like 6 hours at a time just sitting them all out on the floor and taking one off a stack at a time! All of my excel sheets are single worksheets, but the real problem i have run into is coding the powerpoint part. I have got a text box where i can drag and drop the excel files and move them around in order to have them print and "collate". But the powerpoint files usually have like 25 slides or so... and what i am wanting to do is to tell it to print slide 1, slide 2, then go print this excel file... then print slide 3 then this excel file... and so on... just like its doing now with the list of excel files..

I have been searching for days now trying to find the code to make it print the powerpoint one slide at a time... What I had imagined was that i could somehow code a link between a psudeo powerpoint slide # for the list and the actual file so i could drag and drop them around where i wanted them on the list as well. But then have the actual print code pulling from the powerpoint.

All help will be greatly appreciated! I am really feeling beat down by this one.


How Can I Retrieve Cell Values From Multiple Excel Documents In A Folder
I downloaded many xls files. I want to write a macro that reads the xls files and display them in a new empty excel file. I don't want to open each file, just get the cell values within a loop. I couldn't find an example on the internet. If you know a tutorial for visual basic appliacations for excel please let me know.

Copy Content Of Multiple Word Documents And Paste In Single Documet
Hello Everybody...

I am a software tool designer for my organization
Now i am creating in VB that must copy the contents of
multiple word documents and paste in a new single document
That means the new document contains all the contents of
multiple documents

i have done this ... but there is a problem .. which is eating my brain since last 10 days...

when i run that program it is copying the content and pasting in new file...but the problem is .. the second document content is over writing the first that.. at last i can get only the last
document's content in the new file....
this is not what i need
copy 1 file content ..paste in new file.. then insert page break
then the second file content... then page that

Anybody please help me
i am sending the code by Zip file... Trace it ... Refine it
and please send me the solution... byZip file

I am Waiting for ur reply....

For testing.....

Take a new folder for.... Ex: "c:sam"
take one subfolder --- c:samsam1
in that "sam1" place some word documents
when u run the code select the " Sam" folder only by using dir-control
it creates a new document "single1.doc" in "Sam" folder only

Thank U

Copy Content Of Multiple Word Documents And Paste In Single Documet
Hello everybody
I am a software tool designer for my organization
now i have to create a tool in VB that must copy
contents of multiple word documents and paste in a single document one after other..I have done this.. but there is a problem and that is eating my brain since last 10 days
when i do this .. the program compile very good...
but i did't get the exact code is copying contents and
pasting in one single file..but the next content is over writing the first last i am getting last file content

but this is not what i need..

can anybody help me to do this...

copy first file content... paste in new file..then insert page break
second file content must be pasted after the page break...

i am sending the project Zip file...
Please foll it refine it and send me

Thank u
waiting for ur reply...

For testing.....
Take a new folder for Ex: "c:sam"
take one subfolder --- c:samsam1
in that "sam1" place some word documents
when u run the code select the " Sam" folder only by using dir-control
it creates a new document "single1.doc" in "Sam" folder only

Thank U

Print Multiple Documents Within Single Print Job?
Is it possible using the Win32 printing API's to print multiple documents within a single print job to the spooler? The problem I'm running into is that my VB program is printing multiple documents based on a list box selection and because each document is considered a different job, other people's prints are getting mixed in with mine.

My idea would be to load multiple documents within a single print job and once all documents are loaded, then release the print job to print.. I know there is the StartDoc, EndDoc API functions, but not sure if you can embed multiple documents..

Any help or advice would be appreciated..


Multiple Printing
I have this listbox with checkbox option enabled. And i have a proceedure that is called within a loop, this proceedure is responsible for printing.

So here is how it goes.. the user should check the checkboxes for example there are 10 listitems he/she checked 5 the program should print all 5 listitems as for the loop it is fine but i think VB is neglecting the other 4 items cause i can only print 1 which is the first checked listitem.

Please do help me.. this one gives me headaches.. Thanks!!

Ryann Flores
MIS Systems Programmer
TEKTITE bldg., Ortigas, Philippines

Multiple Printing
Is there any way of printing 2 forms onto the same page using the printform command? Or is it possible any other way?

I am asking because I have failed to get a way of scolling the form area so as to get the bottom of the form in view in run time mode. So if i could put the lower portion of the form into another form and print the two together on the same page all will be well.

If anyone can help with either method my life will have been for something. HELP!!!

Printing Over Multiple Pages
how can i set up a printer command to automatically print the contents of a multiline textbox onto different pages, leaving page margins, a title and page number on each page?

Printing To Multiple Printers
I am creating a program which handles about 5000 images / day. Those images need to be printed out however this is an all day process if we send it to one printer. My question is, can I thread out jobs to an array of printers. 1st job to printer A, 2nd job to printer B, 3rd job to printer C, etc... However many printers I decide on.

The heart of the question is not how to print, but how do you suggest to do this efficently. If I have to wait for the first printer to finish recieving the image before I can send to the other printers it is a waste of time. Any thoughts?

Printing Multiple Forms
is there a way to have multiple forms be printed out on one page? I have three different forms and would like them to be printed all on one page and I know how to print a single form, but not multiple at once. Thanks!

Multiple Line Printing
I'm trying to print multiple line from a RichTextBox. If have read trough the forum but didn't find anything that worked or maybe I just don't understand. Can someone please help?

Thanks Htaed

Printing Multiple Reports
how to print the output of more than one independent reports in visual basic or Microsoft access on the same page without classifying any of the reports as a subreport of any other report.

Printing Multiple Pages In VB6
I would not say that I am new to Visual Basic, but I am also not experienced ether. I am working on a program where I will need to do some report printing. I do not want to use the report creaters for this because I am needed to creat a format that they cannot give me. At this time I do not have a major problem because all of the records in my database can be printed on one page. But I know that at some point I will need more than one page for the report.

It is my current understanding that by using the printer object that when I run out of space on the first page the rest of the contents of the report will be discarded, just as they would be by viewing the report using the picture object.

Is this true? If so, how can I set up my program to determine the number of pages to use and format the information for multiple pages? Or will the printer actually just know when the page ends and continue on the next page?

How To Restrict Multiple Printing.
Since users are able to print multiple copies of the same document at the same time, I would like to know how to restrict users from doing so since I cant monitor such an activity from the spool. Thanks.

Printing To Multiple Printers
I have a VB app. that I wrote in VB 6.0.

I was wondering if it is possible, I need to be able to hook up multiple printers to the computer that the application is running on.


Based on specific "events" that happen throughtout the application, pick which printer to print to.

For example....

username = Tom

IF left(username, 1) = "T" THEN

print to printer 1


print to printer 2


I have read about the printers collection but it seems that I must specify the printer for the application, whereas I want to be able to pick the printer on the fly and rever back and forth the whole time the application is running.

Any help is much appreciated.

Printing Multiple Files
if this code will print one file, namely the strMyfile line, how can I get it to print he entire folder content.

Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long

Private Sub Command1_Click()
strMyFile = "C:DesktopVB StuffNew Folder est.txt"
If Dir(strMyFile) = "" Then
MsgBox "File " & strMyFile & " does not exist"
PrintIt = ShellExecute(Me.hwnd, "PRINT", strMyFile, "", "", -1)
End If
End Sub

Any help is greatly appreciated

Printing Multiple Pictureboxes
Can you print more than one picturebox on the same piece of paper? I'm looking to do something like this:

VB Code:
Private Sub cmdPrintPicture_Click() Printer.PaintPicture Picture1.Image, 0, 0For i = 5 To 45    If Check1(i).Value = 1 Then        Picture2.Print Check1(i).Caption    End IfNextPrinter.PaintPicture Picture2.Image, 10, 0Printer.EndDoc End Sub

Where the first PictureBox prints a graph and the second PictureBox prints the corresponding checkboxes. I know the above code won't work but it should at least give an idea of what I want to do. Thanks

Printing Over Multiple Pages

how can i set up a printer command to automatically print the contents of a multiline textbox onto different pages, leaving page margins, a title and page number on each page?

Multiple Report Printing
I need to add a multiple report printing feature for am exiting VB App, using Data Report and Data Environment.

Now the app works fine printing one report at a time like this

DatEnvAccessDB.PrintBill (10)

But when I try to loop… ex:

For I = 0 to Ubound(aBillingIDs)

DatEnvAccessDB.PrintBill (aBillingIDs(I))

Next I

It only prints the first one.

Is it possible to have it print multple times on the same report but with different queries (results) ?


Printing Multiple Copies
I am using the printdlg api within my application. When more than one copy is selected only one is printed if Collate is unchecked. It works fine if Collate is checked. The printer is a HP LaserJet 4000 Series PCL 6. The relevant section of code I'm using is as follows:

Public Function ShowPrinter() As Boolean
'display the print dialog
Dim tPrintDlg As PrintDlg, byteStr() As Byte

On Error GoTo ShowPrinterError

'*** init public properties
iAction = 5 'Action property - ShowPrint
lApiReturn = 0 'APIReturn property
lExtendedError = 0 'ExtendedError property

'*** prepare tPrintDlg data

'lStructSize As Long
tPrintDlg.lStructSize = Len(tPrintDlg)

'hwndOwner As Long
tPrintDlg.hwndOwner = 0

'hDevMode As Long
byteStr = StrConv(DeviceName & Chr(0), vbFromUnicode)

CopyMemory tDevmode.dmDeviceName(0), byteStr(0), IIf(UBound(byteStr) + 1 > UBound(tDevmode.dmDeviceName) + 1, UBound(tDevmode.dmDeviceName) + 1, UBound(byteStr) + 1)
hDevmode.Alloc Len(tDevmode)
hDevmode.SetValue VarPtr(tDevmode), Len(tDevmode)
tPrintDlg.hDevmode = hDevmode

'hdc As Long - init from hDC property
tPrintDlg.hdc = lhdc

'flags As Long - init from Flags property
tPrintDlg.flags = lFlags

'nFromPage As Integer - init from FromPage property
tPrintDlg.nFromPage = lFromPage

'nToPage As Integer - init from ToPage property
tPrintDlg.nToPage = lToPage

'nMinPage As Integer - init from Min property
tPrintDlg.nMinPage = lMin

'nMaxPage As Integer - init from Max property
tPrintDlg.nMaxPage = lMax

'nCopies As Integer - init from Copies property
tPrintDlg.nCopies = lCopies

'hInstance As Long

'lCustData As Long
'*** Call the PrintDlg API function
lApiReturn = PrintDlg(tPrintDlg)

' At this point
' IF COLLATE CHECKED THEN tPrintDlg.ncopies = No. of copies
' USER ENTERED else tPrintDlg.ncopies = 1

'*** handle return from PrintDlg API function
Select Case lApiReturn

Case 0 'user cancelled
If bCancelError = True Then
'generate an error
Err.Raise (2001)
Exit Function
End If

Case 1 'user selected OK
ShowPrinter = True

hDevnames.Handle = tPrintDlg.hDevnames

hDevmode.Handle = tPrintDlg.hDevmode
hDevmode.GetValue VarPtr(tDevmode), Len(tDevmode)
Debug.Print tDevmode.dmDefaultSource

'tDevnames = Space(hDevnames.Size + 1) 'Allocate some space
'hDevnames.GetValue StrPtr(tDevnames), Len(tDevnames) - 1
Debug.Print "Orientation <" & tDevmode.dmOrientation & ">" & IIf(tDevmode.dmFields And DM_ORIENTATION, "Is set field", "Not set")

'nFromPage As Integer - store to FromPage property
lFromPage = tPrintDlg.nFromPage

'nToPage As Integer - store to ToPage property
lToPage = tPrintDlg.nToPage

'nMinPage As Integer - store to Min property
lMin = tPrintDlg.nMinPage

'nMaxPage As Integer - store to Max property
lMax = tPrintDlg.nMaxPage

'nCopies As Integer - store to Copies property
lCopies = tPrintDlg.nCopies

Case Else 'an error occured
'call CommDlgExtendedError
lExtendedError = CommDlgExtendedError 'store to ExtendedError property

End Select

Exit Function

ShowPrinter = False
Exit Function

End Function

I would appreciate any help

Not Printing Multiple Copies In NT
Why is that when I try to print multiple copies of my report it just print a single copy, I only encounter this problem in Windows NT. I am using Seagate Crystal Reports 8 as my reporting tool.

Copyright © 2005-08, All rights reserved