Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
VERY Green to QM
#5
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
Code:
Copy      Help
;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.


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)