I download a program located at ftp://ftp.softcircuits.com/vbsrc/browse.zip and being a newbie, i failed to make the code work. i mean to make my code work with yoursit... the code is given below:

Private Sub Command1_Click()

Dim myfile
Dim i As Integer

For i = 1 To 999
myfile = Dir("C:\" & i & ".bmp")
If Not myfile = i & ".bmp" Then
fSaveGuiToFile ("C:\" & i & ".bmp")
Exit For
End If
Next i

End SubI would like the user to choose the path like the one at ftp://ftp.softcircuits.com/vbsrc/browse.zip but failed to integrate this code of mine to work with it... could you please help me out. thanx

Recommended Answers

All 6 Replies

it's not "If Not" it's ELSE

You don't exit a for loop?

it's probably best to put it into a sub ie


sub loop()
Dim myfile
Dim i As Integer


For i = 1 To 999
myfile = Dir("C:\" & i & ".bmp")
ELSE myfile = i & ".bmp" Then
fSaveGuiToFile ("C:\" & i & ".bmp")
End If
Next i
End Sub

fSaveGuiToFile

This function is not defined in the code anywhere.

By the way suRoot

If Not myfile = i & ".bmp" Then

is perfectly legitimate code. It's saying if filename myfile is not equal to i & ".bmp".

the code available for download is actually a script which allows user to choose the file location and shows the location in a text box! and my script which i posted is actually a part of my code which saves to C:\ when "command1" is pressed.

I would like to make it in such a way that it saves to the location specified by the user and not to C:\ which cannot be changed by the user! hope u understand.

thanx! hope to get the help from u again.

well.... isn't there anyone left!! to help me

not thought about using a common dialog control? aka CMDIALOG. If you want the user to specify something what about the inputbox function ie

Dim response
response = InputBox("Enter filename")
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.