View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
[email protected] DFStoneJr@yahoo.com is offline
external usenet poster
 
Posts: 5
Default Better MRU list possible via VBA?

Thanks for the answers. I appreciate it, though, since I'm an
accountant and not a professional programmer, "using low level IO" and
the API are beyond my current skill set.

Tom is correct that there's a UserForm that's populated with the list
of files stored in the .ini file:

Private Sub UserForm_Initialize()
Dim i As Integer
For i = 1 To 25
lstMRU.AddItem
System.PrivateProfileString(FileName:="C:\Windows\ mru.ini",
Section:="MRU_Files", Key:="MRU" & Format(i, "00"))
Next i
End Sub

Private Sub lstMRU_Click()
cmdOpen.Enabled = True
End Sub

Private Sub cmdCancel_Click()
MRU.Hide
Unload MRU
End Sub

Private Sub cmdOpen_Click()
On Error GoTo Trap
MRU.Hide
Documents.Open lstMRU.Value
Unload MRU
End
Trap:
If Err.Number = 5174 Then MsgBox "Word cannot find the file " &
lstMRU.Value & "." & vbCr & vbCr & "The file may have been renamed,
mobved or deleted.", vbOKOnly + vbCritical, "MRU - File Not Found"
End Sub

What makes this thing a beaut is that you can vary the size of the
list. The default is 25, but you can make it larger or smaller to suit
your needs. It sure is handy in Word, but it'd be even more handy in
Excel.

Thanks again for the responses.