Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dir() on a Mac (Word VBA)

Status
Not open for further replies.

dsi

Programmer
Mar 13, 2000
964
US
From the Word VBA:

Using the Dir() method on a Mac does not like the * wildcard. I do not use a Mac but am trying to help someone out. The help file indicates that it should work, but it is unsuccessful.

You should only have to change the format of the path. This snipit should echo back the name of each .wmp file in the directory.

Works on a PC
Code:
Dim sPath As String
Dim sFile As String
sPath = ActiveDocument.Path & "\"
sFile = Dir(sPath & "*.wpm")
Do While sFile <> &quot;&quot;
    MsgBox sFile
    sFile = Dir 
Loop
Doesn't work on a Mac
Code:
Dim sPath As String
Dim sFile As String
sPath = ActiveDocument.Path & &quot;:&quot;
sFile = Dir(sPath & &quot;*.wpm&quot;)
Do While sFile <> &quot;&quot;
    MsgBox sFile
    sFile = Dir 
Loop
If we replace the * with an actual filename, it echos back the filename properly. It just seems to be having trouble with the wildcard.

Any help would be greatly appreciated.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top