L
lq495
I need to be able to loop through and capture the file name of all .vsd files
in the current directory. This code gets the file name but doesn't loop
correctly.
Sub FileNameTOC()
Dim CurFileName As String
Dim currentDoc As String
Dim PathFileName As String
Dim PathName As String
currentDoc = ActiveDocument.Name
' Set the default pathname
PathName = CurDir & "\"
PathFileName = PathName & "*.vsd"
' This variable holds the file name
'CurFileName = Dir(PathFileName)
'Loop through each file name
'or Do while CurFileName <>""
While CurFileName <> ""
Debug.Print CurFileName
CurFileName = Dir(PathFileName)
Wend
How can i get the loop to work correctly?
in the current directory. This code gets the file name but doesn't loop
correctly.
Sub FileNameTOC()
Dim CurFileName As String
Dim currentDoc As String
Dim PathFileName As String
Dim PathName As String
currentDoc = ActiveDocument.Name
' Set the default pathname
PathName = CurDir & "\"
PathFileName = PathName & "*.vsd"
' This variable holds the file name
'CurFileName = Dir(PathFileName)
'Loop through each file name
'or Do while CurFileName <>""
While CurFileName <> ""
Debug.Print CurFileName
CurFileName = Dir(PathFileName)
Wend
How can i get the loop to work correctly?