Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Remember the latest 10 folders that I have opened

Posted on 1998-08-26
2
Medium Priority
?
140 Views
Last Modified: 2010-04-30
I'd like to create a program that can remember the latest 10 folders that I have opened.
The program must work from any folder I open.

Example:
If I open "My Computer" there should be a button on the title bar where I can choose to go to one of the folders I have been in.

Norton Navigator can do this, but I don't feel like bying that.

How many points do you want for that?
0
Comment
Question by:jfl
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 14

Accepted Solution

by:
waty earned 80 total points
ID: 1431059
You find a call on my web site implement MRU (Most Recently Used). You could use this class for your job.

http://www.geocities.com/ResearchTriangle/6311/


By the way, here is code  :

Option Explicit

' ***
' *** An object to maintain the last files opened
' *** opened by a program
' ***
' *** class_MRU gives you a quick and reliable way to provide a Most-Recently Used (MRU) file
' *** list in your application.

Private colMRUFiles  As New Collection
Private Num          As Integer

Public Sub Add(file As String)

   If colMRUFiles.count = 0 Then
      colMRUFiles.Add file, UCase(file)
   Else
      On Error Resume Next
      colMRUFiles.Remove UCase(file)
      colMRUFiles.Add file, UCase(file), 1
      If colMRUFiles.count > Num Then
         colMRUFiles.Remove colMRUFiles.count
      End If
   End If

End Sub

Public Sub Clear()
   ' *** Clears all files from the list.

   Do While colMRUFiles.count > 0
      colMRUFiles.Remove 1
   Loop

End Sub

Public Property Get count() As Long
   ' *** Returns the number of files in the list.

   count = colMRUFiles.count

End Property


Public Property Get ITem(i As Integer) As String
   ' *** Returns the nth item from the list

   On Error GoTo ItemError
   ITem = colMRUFiles(i)
   Exit Property

ItemError:
   ITem = ""

End Property

Public Sub Load(Optional AppName As Variant)

   Dim v As Variant
   Dim i As Integer
   Dim j As Integer
   Dim AppN As String

   If IsMissing(AppName) Then
      AppN = App.ProductName
   Else
      AppN = CStr(AppName)
   End If

   v = GetAllSettings(AppN, "colMRUFiles")

   If Not IsEmpty(v) Then
      i = UBound(v, 1)
      Me.Clear
      colMRUFiles.Add v(i, 1), UCase(v(i, 1))

      For j = i - 1 To LBound(v, 1) Step -1
         colMRUFiles.Add v(j, 1), UCase(v(j, 1)), 1
      Next j
   End If

End Sub

Public Property Get Number() As Integer
   ' *** Gets the maximum size of the list.

   Number = Num

End Property

Public Property Let Number(i As Integer)
   ' *** Sets the maximum size of the list.

   Num = i

End Property

Public Sub Remove(file As String)

   On Error Resume Next
   colMRUFiles.Remove UCase(file)

End Sub

Public Sub Save(Optional AppName As Variant)

   Dim i As Integer
   Dim AppN As String

   On Error Resume Next

   If IsMissing(AppName) Then
      AppN = App.ProductName
   Else
      AppN = CStr(AppName)
   End If

   DeleteSetting AppN, "colMRUFiles"

   For i = 1 To colMRUFiles.count
      SaveSetting AppN, "colMRUFiles", i, colMRUFiles(i)
   Next i

End Sub

Public Sub Update(F As Form)
   ' *** Note:  The form must contain a menu control array
   ' ***        named mnuMRUFiles that is at least as big
   ' ***        as Number.

   Dim i As Long


   On Error GoTo NextStep
   For i = 1 To Num
      F.mnuMRUFiles(i).Visible = False
   Next i

NextStep:

   On Error GoTo MenuEnd
   If colMRUFiles.count > 0 Then
      F.mnuMRUFiles(0).Visible = True

      For i = 1 To colMRUFiles.count
         F.mnuMRUFiles(i).Caption = colMRUFiles(i)
         F.mnuMRUFiles(i).Visible = True
      Next i

      Do
         F.mnuMRUFiles(i).Visible = False
         i = i + 1
      Loop
   Else
      i = 0
      Do
         F.mnuMRUFiles(i).Visible = False
         i = i + 1
      Loop
   End If

MenuEnd:

End Sub

Private Sub Class_Initialize()

   Num = 10

End Sub


0
 

Author Comment

by:jfl
ID: 1431060
Thanks!
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question