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.Drawing

Imports System.Drawing.Printing

Imports System.Collections.ObjectModel

PublicClass Form1

Dim myCounter = 0

Dim filesAs ReadOnlyCollection(OfString) =My.Computer.FileSystem.GetFiles("H:\My Documents\Desktop\Drawings\")

Dim NumOfFiles = files.Count

PrivateSub Button1_Click(ByVal senderAs System.Object,ByVal eAs System.EventArgs)Handles Button1.Click

Do

myCounter += 1

Dim documentAsNew PrintDocument()

AddHandler document.PrintPage,AddressOf DocumentPrintPage

document.Print()

LoopUntil myCounter = NumOfFiles - 3

EndSub

Sub DocumentPrintPage(ByVal senderAsObject,ByVal eAs System.Drawing.Printing.PrintPageEventArgs)

Dim imageAs Image = System.Drawing.Image.FromFile(files(NumOfFiles - myCounter - 3))

Try

e.Graphics.DrawImage(image,New Point(0, 0))

Finally

image.Dispose()

EndTry

EndSub

EndClass

[3958 byte] By [jsena] at [2007-12-28]