Solved

Remember the latest 10 folders that I have opened

Posted on 1998-08-26
2
138 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 20 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses
Course of the Month7 days, 16 hours left to enroll

617 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