Private Sub mnuFileMRU_Click(index As Integer)
strFileNewName1 = (Left(mnuFileMRU(index).Caption, InStr(1, mnuFileMRU(index).Caption, "\DAF")) & "Map\")
strFileNewName2 = (Mid(mnuFileMRU(index).Caption, InStr(1, mnuFileMRU(index).Caption, "MY"), 8) & ".bmp")
strFileNewName3 = strFileNewName1 & strFileNewName2
'MsgBox " " & strFileNewName3
Picture1.Picture = LoadPicture(strFileNewName3)
Call ConvertMRU
End Sub
Private Sub ConvertMRU()
Dim intFF As Integer
Dim strReaded() As String
Dim index as integer
intFF = FreeFile
Open mnuFileMRU(index).Caption For Input As #intFF
strReaded = Split(Input(LOF(intFF), #intFF), vbLf)
Close #intFF
strFileNewName4 = (Left(mnuFileMRU(index).Caption, InStr(1, mnuFileMRU(index).Caption, "\DAF")) & "Setting\Daf.txt")
'MsgBox "" & strFileNewName4
intFF = FreeFile
Open strFileNewName4 For Output As #intFF
Print #intFF, Join(strReaded, vbCrLf);
Close #intFF
End Sub
above is part of my code. it came out an error "variable not defined" and point to index(the red color). how to improve the code above?
Open the project in my attachment and look at the menu I created on the form. Under CleanMRU you will see a bunch of menu items with no caption, and a sequential index number.
That index number is what the code is looking for, and what you do not have.
Open the project in my attachment and look at the menu I created on the form. Under CleanMRU you will see a bunch of menu items with no caption, and a sequential index number.
That index number is what the code is looking for, and what you do not have.
Private Sub ConvertMRU()
Dim intFF As Integer
Dim strReaded() As String
Dim i As Integer
intFF = FreeFile
For i = 1 To 4
Open mnuFileMRU(i).Caption For Input As #intFF
strReaded = Split(Input(LOF(intFF), #intFF), vbLf)
Close #intFF
MsgBox "" & mnuFileMRU(i) strFileNewName4 = (Left(mnuFileMRU(i).Caption, InStr(1, mnuFileMRU(i).Caption, "\DAF")) & "Setting\Daf.txt")
intFF = FreeFile
Open strFileNewName4 For Output As #intFF
Print #intFF, Join(strReaded, vbCrLf);
Close #intFF
Next
End Sub
i try the loop. but by using the message box ( the red line). it came out the message "true" not the directory of file. why?????