03-18-2010, 08:49 PM
Should the macro process all files in loop? Or you will run the macro for each file?
If in loop, all code after foreach must be tab-indented. Or comma-indented.
Macro Macro1195
--------------------
When posting QM code to the forum, use menu Edit->Other Formats to copy it. Then simply paste here. Don't use the Code button.
If in loop, all code after foreach must be tab-indented. Or comma-indented.
Macro Macro1195
;Before you run this macro:
;Excel should not be running.
;Make sure that documents will be maximized, so that document text is displayed in title bar.
;I have Office 2003. If your Office version is other, this macro may not work.
;______________________________________________
;repeat for each excel file
Dir d
foreach(d "$Documents$\*.xls" FE_Dir)
,str sPath=d.FileName(1)
,
,;open, skip or abort?
,str message.from("Open and manipulate this file?[][]" d.FileName)
,sel(mes(message "" "YNC"))
,,case 'C' ret
,,case 'N' continue
,
,;open
,str cl.from("''" sPath "''")
,run "excel" cl
,str excelTitleBarText.from("Microsoft Excel - " d.FileName)
,int w1=wait(30 WA win(excelTitleBarText "XLMAIN"))
,
,mes "Ready?"
,
,'A{}
,'icRRDDDDRSD A{}
,'oe
,5 win("Format Cells" "bosa_sdm_XL9")
,'R A{mm}
,'Y
,act w1
,'LR Cc
,'DDDDLLL Cv
,'RRRUUU Cc
,'DDDLL Cv
,'LSR Cc
,'S{REDL} Cv
--------------------
When posting QM code to the forum, use menu Edit->Other Formats to copy it. Then simply paste here. Don't use the Code button.