LOCAL lnDeviceCount,lnDeviceNum,loWia,loItem,loImages,loImage,lnCntr,lcFname,loFileCollection,lnNewPk lnDeviceNum=0 TRY loFileCollection=CREATEOBJECT('collection') loWia = CreateObject("Wia.Script") lnDeviceCount=loWia.Devices.Count IF lnDeviceCount#1 IF lnDeviceCount=0 =MESSAGEBOX("There are no recognized document imaging devices attached to your computer",48,"Scan Aborted") RETURN .T. ELSE =MESSAGEBOX("There are "+TRANSFORM(lnDeviceCount)+" recognized imaging devices on your computer."+CHR(10)+"Using: "+loWia.Devices(0).name,48,"Scanner Selection") ENDIF ENDIF loItem = loWia.Create(lnDeviceNum) && Item object represents WIA hardware device loImages=loItem.GetItemsFromUI(0,0) IF VARTYPE(loImages)='O' lnCntr=0 FOR EACH loImage IN loImages lnCntr=lnCntr+1 lcFname=[C:\Temp\]+[ScanImage]+PADL(lnCntr,3,'0')+[.bmp] WAIT WINDOW NOWAIT 'Scanning to ...'+CHR(13)+lcFname loImage.Transfer(lcFname,.F.) IF FILE(lcFname) loFileCollection.add(lcFname,JUSTFNAME(lcFname)) ENDIF ENDFOR ENDIF WAIT CLEAR IF loFileCollection.count>0 * Do something the the file collection... ENDIF CATCH TO oErr =MESSAGEBOX(oErr.Message,48,'Windows Imaging not Available') ENDTRY