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

File naming

Status
Not open for further replies.

Sika2

Technical User
Sep 25, 2001
41
NZ
No doubt there is a simple explanation for this but I just can't see it.
I am trying to name a number of files with the same name but with a different numeric. eg file name "Green" files saved as Green1, Green2, etc. I don't have a problem with the actual naing but with the numbering.
I have three forms and am declaring the public varible in the first form "Public IntNum As Integer". The name of the file to save is obtained in the second form. When I run the file save in the third form I am using "IntNum = IntNum + 1" to increase the number. The program is not recognising Intnum as a variable at this point. With error of "variable not defined "

What am I doing wrong?? Thanks
 

try using FirstForm.IntNum = FirstForm.IntNum + 1, or, if you want to use simply IntNum put the public declaration in a BAS module - which is probably a better solution anyhow.
 
yea, better off with IntNum declared in a BAS module:

Code:
Option Explicit
Public IntNum as Integer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top