Dim wkMuniNum As Long Dim wkMuniStr As String ' SQHD_Prefix = "SQHD" wkFileExtension=".txt" For wkMuniNum = 1 To 1000 ' ' Any files for this muni? Pick one of the six to see if it's there. ' wkMuniStr = Trim(Str(wkMuniNum)) If Len(wkMuniStr) = 4 Then ' nothing to do ElseIf Len(wkMuniStr) = 3 Then wkMuniStr = "0" & wkMuniStr ElseIf Len(wkMuniStr) = 2 Then wkMuniStr = "00" & wkMuniStr ElseIf Len(wkMuniStr) = 1 Then wkMuniStr = "000" & wkMuniStr End If ' ' Look for the first file ' wkSearchFile = wkTaxDataPath & SQHD_Prefix & wkMuniStr & wkFileExtension ' If Len(Dir(wkSearchFile)) = 0 Then GoTo getNextMuni '///////////////// get outof here and get next muni End If . . Logic if the file is found . . getNextMuni: Next wkMuniNum
From novice to tech pro — start learning today.