Wednesday, March 3, 2010

How do I set up an Excel macro for printing one sheet into .mdi file with preset name?

Need help on printing one Excel sheet into Microsoft Office Document Imaging file with preset (cell K1) value for the ';save file name';. I can save the entire excel workbook this way, but it doesnt work for print-saving a file. I got this far:








Sub NATP()





MsgBox ';Message...';


'


With Application


.DefaultFilePath = ';D:';


End With


Sheets(';List2';).Select


Thisfile = Range(';K1';).Value ' K1 contains the name for the file


FileDrive = ';D:\TARGET FOLDER\';


' ActiveWindow.SelectedSheets.PrintOut Printtofile:=True,


ActiveWindow.SelectedSheets.PrintOut Filename:=FileDrive %26amp; Thisfile %26amp; ';.mdi';, Copies:=1, Collate:=True


' FileFormat:=xlNormal, Password:=';';, WriteResPassword:=';';, _


' ReadOnlyRecommended:=False, CreateBackup:=False


Range(';K1';).Select


End SubHow do I set up an Excel macro for printing one sheet into .mdi file with preset name?
Got to http://www.mrexcel.com register for free and post your question there. It鈥檚 an excellent question forum with loads of Excel experts on hand just wanting to help. Post your code as well as your question.

No comments:

Post a Comment