This code segment shows how to scan all the pages in the scanner's automatic document feeder (ADF) to a multipage file using a file template. The example creates three image pages and names them using the prefix "img" (for example, img0001.tif, img0002.tif).
Private Sub cmdTemplate_Click()
ImgScan1.ScanTo = UseFileTemplateOnly '4
'Set the image property to a template name.
ImgScan1.Image = "D:\image2\img"
'MultiPage must be true in order to create files with
'more than one page.
ImgScan1.MultiPage = True
'Create 3 page image files.
ImgScan1.PageCount = 3
'Do not show the scanner's TWAIN UI.
ImgScan1.ShowSetupBeforeScan = False
'Scan without using dialog box.
ImgScan1.StartScan
End Sub