File system objects(FileExists) and external apps

G

Gilgamesh

Hi,
I have two questions that I'm hoping somebody can help me with.

1 - I have a scripting file system defined and I'm using the following
command
If oFS.FileExists("D:\temp\Header-*.xls") Then Kill("D:\temp\Header-*.xls")
If I fully specify file names then this works but when I try to use
wildcards in the name the FileExists returns a False value.
Is there anyway I can get wildcards working like this.

2 - Is there anyway to link VBA macros with non MS apps?
I have a filename in VBA and I want to run WinZip on it.

Thanks
 
J

JP

1- I don't think the FileExists method accepts a wildcard. As a
workaround, use the Dir function to see if a matching file exists,
then a Do While Loop to delete your files

Dim strFile As String

strFile = Dir("D:\temp\Header-*.xls")

Do While Len(strFile) > 0
Kill strFile
strFile = Dir
Loop


2- See http://www.rondebruin.nl/zip.htm


--JP
 
G

Gilgamesh

1- I don't think the FileExists method accepts a wildcard. As a
workaround, use the Dir function to see if a matching file exists,
then a Do While Loop to delete your files

Dim strFile As String

strFile = Dir("D:\temp\Header-*.xls")

Do While Len(strFile) > 0
Kill strFile
strFile = Dir
Loop


2- See http://www.rondebruin.nl/zip.htm


--JP

Thank You
These worked pefectly.
 

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