excel - DIR function in vba works diffrent when passing a value directly and by a variable -
hi have files *in particular folder in system when use *the below** code gives files in folder (passing path directly)
filenm = dir("c:\documents , settings\murugan.k\desktop\daily report automation\eve report\trial\") until filenm = "" activesheet.cells(ctr, 12).value = filenm ctr = ctr + 1 filenm = dir() loop
but when store same path in variable , pass varible dir function gives me 2 files (autoexec.bat & bar.emf)
filenm = dir(pth) until filenm = "" activesheet.cells(ctr, 12).value = filenm ctr = ctr + 1 filenm = dir() loop
could 1 please me in resolving problem because can't hard code path in macro has dynamic (changes per user)
try different attributes dir() function.
path = "c:\documents , settings\murugan.k\desktop\" & _ "daily report automation\eve report\trial\" filenm = dir(path, vbnormal) until filenm = "" activesheet.cells(ctr, 12).value = filenm ctr = ctr + 1 filenm = dir() loop
Comments
Post a Comment