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?Code: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




Reply With Quote