Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Better MRU list possible via VBA?

I'm intrigued by this Word "hack," which uses VBA to manage a longer
most-recently-used documents list than the default nine-item list in
Word:

http://hacks.oreilly.com/pub/h/2555

I know I fill up my MRU list pretty quickly, and nine items isn't
enough to keep me from having to scrounge through folders in search of
files. Is such a "hack" possible for Excel?

It appears to me that most of the code is easily reproducible in, or
modifiable for, Excel. The key appears to be in the code at the bottom
of the page, which reads file names from and writes them to an .ini
file, and I haven't been able to come up with anything in Excel to
mimic that.

Any suggestions, thoughts or pointers?

TIA.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default Better MRU list possible via VBA?

Dick Kusleika has a favorites menu:

http://www.dailydoseofexcel.com/arch...avorites-menu/

HTH,
Bernie
MS Excel MVP


wrote in message oups.com...
I'm intrigued by this Word "hack," which uses VBA to manage a longer
most-recently-used documents list than the default nine-item list in
Word:

http://hacks.oreilly.com/pub/h/2555

I know I fill up my MRU list pretty quickly, and nine items isn't
enough to keep me from having to scrounge through folders in search of
files. Is such a "hack" possible for Excel?

It appears to me that most of the code is easily reproducible in, or
modifiable for, Excel. The key appears to be in the code at the bottom
of the page, which reads file names from and writes them to an .ini
file, and I haven't been able to come up with anything in Excel to
mimic that.

Any suggestions, thoughts or pointers?

TIA.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Better MRU list possible via VBA?

The article appears incomplete - it appears that a userform is required to
actually select a file from the larger list (and the code for populating the
userform is not included) - it doesn't use the built in MRU capability.
Given that, you could certainly program similar functionality into Excel
using low level file IO rather than using an INI file. (the
privateprofilestring functions are not included in Excel VBA, but they really
are not necessary).

http://support.microsoft.com/kb/90988/en-us
http://support.microsoft.com/default...b;en-us;151262

http://www.applecore99.com/gen/gen029.asp

If you actually want to use that functionality (ini file functionality), you
can use the windows API which those functions are "fronting"

see MSDN for help on PrivateProfileString
Working with Sequential Access Files
ACC: How to Use Get, WritePrivateProfileString Functions 1.x/2.0

that is for the 16-bit API, but you can adapt it to the 32 bit version.

--
Regards,
Tom Ogilvy


" wrote:

I'm intrigued by this Word "hack," which uses VBA to manage a longer
most-recently-used documents list than the default nine-item list in
Word:

http://hacks.oreilly.com/pub/h/2555

I know I fill up my MRU list pretty quickly, and nine items isn't
enough to keep me from having to scrounge through folders in search of
files. Is such a "hack" possible for Excel?

It appears to me that most of the code is easily reproducible in, or
modifiable for, Excel. The key appears to be in the code at the bottom
of the page, which reads file names from and writes them to an .ini
file, and I haven't been able to come up with anything in Excel to
mimic that.

Any suggestions, thoughts or pointers?

TIA.


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Better MRU list possible via VBA?

Couple more links.

http://support.microsoft.com/kb/75639/en-us
Accessing Windows Initialization Files from Visual Basic

http://support.microsoft.com/kb/210115/en-us
ACC2000: How to Convert API Calls from 16-bit to 32-bit

--
Regards,
Tom Ogilvy

" wrote:

I'm intrigued by this Word "hack," which uses VBA to manage a longer
most-recently-used documents list than the default nine-item list in
Word:

http://hacks.oreilly.com/pub/h/2555

I know I fill up my MRU list pretty quickly, and nine items isn't
enough to keep me from having to scrounge through folders in search of
files. Is such a "hack" possible for Excel?

It appears to me that most of the code is easily reproducible in, or
modifiable for, Excel. The key appears to be in the code at the bottom
of the page, which reads file names from and writes them to an .ini
file, and I haven't been able to come up with anything in Excel to
mimic that.

Any suggestions, thoughts or pointers?

TIA.


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,452
Default Better MRU list possible via VBA?

Lookup in Excel VBA SaveSetting and GetSetting.
That can replace System.PrivateProfileString
In the code you mentioned.
Or you could just use a simple .ini file. Very easy to read
and write to with the Windows API.

RBS


wrote in message
oups.com...
I'm intrigued by this Word "hack," which uses VBA to manage a longer
most-recently-used documents list than the default nine-item list in
Word:

http://hacks.oreilly.com/pub/h/2555

I know I fill up my MRU list pretty quickly, and nine items isn't
enough to keep me from having to scrounge through folders in search of
files. Is such a "hack" possible for Excel?

It appears to me that most of the code is easily reproducible in, or
modifiable for, Excel. The key appears to be in the code at the bottom
of the page, which reads file names from and writes them to an .ini
file, and I haven't been able to come up with anything in Excel to
mimic that.

Any suggestions, thoughts or pointers?

TIA.




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Better MRU list possible via VBA?

Just for clarification:
Or you could just use a simple .ini file. Very easy to read
and write to with the Windows API.


The code cited does use a simple .ini file as I read it.

--
Regards,
Tom Ogilvy



"RB Smissaert" wrote:

Lookup in Excel VBA SaveSetting and GetSetting.
That can replace System.PrivateProfileString
In the code you mentioned.
Or you could just use a simple .ini file. Very easy to read
and write to with the Windows API.

RBS


wrote in message
oups.com...
I'm intrigued by this Word "hack," which uses VBA to manage a longer
most-recently-used documents list than the default nine-item list in
Word:

http://hacks.oreilly.com/pub/h/2555

I know I fill up my MRU list pretty quickly, and nine items isn't
enough to keep me from having to scrounge through folders in search of
files. Is such a "hack" possible for Excel?

It appears to me that most of the code is easily reproducible in, or
modifiable for, Excel. The key appears to be in the code at the bottom
of the page, which reads file names from and writes them to an .ini
file, and I haven't been able to come up with anything in Excel to
mimic that.

Any suggestions, thoughts or pointers?

TIA.



  #7   Report Post  
Posted to microsoft.public.excel.programming
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.

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Better MRU list possible via VBA?

Just had a thought ... since I'm not real good at API stuff, what do
you guys think about writing the file names to cells in PERSONAL.XLS
and populating the form from the range of stored names?

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Comparing List A to List B and add what's missing from List B Gilbert Excel Discussion (Misc queries) 2 July 20th 09 11:18 PM
Comparing List A to List B and add what's missing from List B Gilbert Excel Discussion (Misc queries) 1 July 20th 09 08:41 PM
validation list--list depends on the selection of first list Michael New Users to Excel 2 April 27th 06 10:23 PM
list 1 has 400 names List 2 has 4000. find manes from list 1 on 2 Ed Excel Worksheet Functions 5 September 12th 05 09:48 AM
find names on list 1 in list 2. list 1 4000 names list 2 400 name Ed Excel Worksheet Functions 1 September 4th 05 12:48 AM


All times are GMT +1. The time now is 05:23 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"