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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

next without for error

Status
Not open for further replies.

lemonhalls

Technical User
Jun 11, 2004
52
CA
Can you spot where I went wrong?
I'm getng a next without for error!

Thanks!!

excerpt...
_____________________
For i = 1 To 10
'if there is no previous copy of _DBReport(LastMonth) saved,
'then reporting.doc will be saved as _DBReporting(LastMonth)
If fIsFileDIR(newDir & "_DBReport" & lastMonth & i) = 1 Then
Next i
Else
MsgBox ("A copy of " & "_DBReport" & lastMonth & i - 1 & "is currently opened." _
& vbCrLf & "This version will be saved as _DBReport" & lastMonth & i)

aDoc.SaveAs FileName:=newDir & "_DBReport" & lastMonth & i

End If
 
Try this:
For i = 1 To 10
'if there is no previous copy of _DBReport(LastMonth) saved,
'then reporting.doc will be saved as _DBReporting(LastMonth)
If fIsFileDIR(newDir & "_DBReport" & lastMonth & i) <> 1 Then
MsgBox ("A copy of " & "_DBReport" & lastMonth & i - 1 & "is currently opened." _
& vbCrLf & "This version will be saved as _DBReport" & lastMonth & i)
aDoc.SaveAs FileName:=newDir & "_DBReport" & lastMonth & i
End If
Next i

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top