Disgarding lnk files

G

Guest

Hello.

I am writing some VBA in excel which auto-archives files in a set of
folders/subfolders. All's going well, other than when the
application.filesearch command encounters a shortcut, it tries to archive the
file the shortcut points to.

I need to isolate the .lnk files to disregard them.

I've tried to isolate the shortcuts using '.filename = "*.lnk"', but to no
avail.

Could anyone please tell me how to isolate them?

Thanks in advance.
 
T

Tom Ogilvy

.filename like "*.lnk"

to demonstrate from the immediate window:

sStr = "C:\My folder\My File.lnk"

? sStr like "*.lnk"
True
sStr = "C:\My folder\My File.xls"
? sStr like "*.lnk"
False
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top