Avatar of Ryan Bayne
Ryan Bayne
Flag for United Kingdom of Great Britain and Northern Ireland asked on

Going Through My Code With A Comb

This code is meant to load the most recent file from an MRU list. I got it on here but seeing how Form Load is the first procedure encountered on my application and the text file loaded is the one written in the code and not the latest in the MRU list I'm guessing it doesnt work.

Please confirm if the code to load the most recent MRU is here as I was told that it is however I cant see what it is. Please explain a little. Cheers.


'MRU List collection statements (Confirm what these do).
Set m_FileTitles = New Collection
Set m_FileNames = New Collection

'Program start, call subroutines LoadMRUList and ShowMRUList to load and display the MRU list.
dlgFile.Flags = cdlOFNFileMustExist Or cdlOFNHideReadOnly Or cdlOFNLongNames
dlgFile.CancelError = True
dlgFile.Filter = "Text Files (*.txt)|*.txt|All Files " & _
"(*.*)|*.*"
dlgFile.FilterIndex = 0

'Call load and save mrulist procedures
LoadMRUList
ShowMRUList

'Load last workouthistory file
Dim myLine As String, ff As Integer
ff = FreeFile
Open App.Path & "\workouthistory.txt" For Input As #ff
    Do Until EOF(ff)
        Line Input #ff, myLine
            List1.AddItem Replace(myLine, "-", "")
    Loop
Close #ff

'Initiates variable for date and creates array for list of dates on file.
Dim dates(9000) As Date
Dim i As Integer: i = 9000
dates(i) = Format(Now, "dd/mm/yyyy")
lblDate = dates(i)

'Display the time with enabled timer control.
lblTime = Time
Timer1 = True

End Sub
Programming

Avatar of undefined
Last Comment
pratap_r

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
pratap_r

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Ryan Bayne

ASKER
The problem is that on loading my form the load form procedure should find the top file in the MRU, file 1. It would then be opened and its data input to my List box named List1.

At the moment it only opens the file workouthistory.txt. It did work before but not now.
Ryan Bayne

ASKER
I just need someone to confirm if this code is meant to do this or not because I was told it does so I dont understand it too much. Please confirm this only as I'm getting help on my overall application on another question.

Does it have the required code and it doesnt work or does it not have the code?
pratap_r

I don't see the code for loading the top file in your question. unless the file is loaded in LoadMRUList function. so no, the code will not work as you expect.
Your help has saved me hundreds of hours of internet surfing.
fblack61