Hi, there,
I have a payroll in an Excell file, in which each sheet belongs to an
employee. Since I have a lot functions or calculation in that file I can not
use copy/paste ,and instead I use File - print ... command to print each
sheet seperately to a "tiff" file, then I mail them for the coresponding
employee. well it takes time.. so I decided to write codes to do it
automatically; such as ;
'======
Sub MakeSlips()
Dim EmpSign, Filename As String, i As Integer
For i = 4 To 35
EmpSign = Worksheets("PAYROLL").Cells(i, 5).Value
Filename = "H:/Accounting/Employees/SalarySlips/" & EmpSign & ".tiff"
Worksheets(EmpSign).PrintOut PrintToFile:=True, PrToFileName:=Filename
Next i

End Sub
'======
but I found that the results were quite strange and different under
different situations.
1) when I have used previously manual job, by file,print... the code above
afterward the codes work correctly, with only this problem that it opens all
30 tiff files...have to close them.
2) but when i restart the computer and run the code (without trying to do it
manually on that session), it makes all 30 tiff files, but I can not open
them and it prompts me each with;
" The selected file is not a valid Microsoft Office Document Imaging file"
why is it so?? please help!
--
Thans & Best regards
Leo, InfoSeeker