How do I print multiple tif files from an excel list?
Hello,
I tried the code below to make a program loop through and print every tif file in a specific folder. It seems to do that just fine, however, most of the time I need to print files that are not in numerical order. Is there a way to create a list of the drawings in excel and have the program loop through and print the drawings in the order listed?
This would be a GREAT help, thank you,
jordan
Imports
System.DrawingImports System.Drawing.Printing
Imports
System.Collections.ObjectModelPublic
Class Form1Dim myCounter = 0Dim filesAs ReadOnlyCollection(OfString) =My.Computer.FileSystem.GetFiles("H:\My Documents\Desktop\Drawings\")Dim NumOfFiles = files.CountPrivateSub Button1_Click(ByVal senderAs System.Object,ByVal eAs System.EventArgs)Handles Button1.ClickDomyCounter += 1
Dim documentAsNew PrintDocument()AddHandler document.PrintPage,AddressOf DocumentPrintPagedocument.Print()
LoopUntil myCounter = NumOfFiles - 3EndSubSub DocumentPrintPage(ByVal senderAsObject,ByVal eAs System.Drawing.Printing.PrintPageEventArgs)Dim imageAs Image = System.Drawing.Image.FromFile(files(NumOfFiles - myCounter - 3))Trye.Graphics.DrawImage(image,
New Point(0, 0))Finallyimage.Dispose()
EndTryEndSubEnd
Class
