ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Favorites.xla (https://www.excelbanter.com/excel-programming/331995-favorites-xla.html)

GregR

Favorites.xla
 
Dick Krusleika, has an add-in, favorites.xla that adds a favorite list
to the File Menu. It limits the list to 9 files, which I have changed
to 15 files and thus, this line in the add-in fails to open any files
10 - 15:

With CommandBars.ActionControl
'Try to open the file
sCap = HandleAmp(Right(.Caption, Len(.Caption) - 3), _ False)
On Error Resume Next
Set wb = Workbooks.Open(sCap)
On Error GoTo 0

I need an or statement, such as:

Or sCap = HandleAmp(Right(.Caption, Len(.Caption) - 4), False)

but it doesn't work. How do I make it work? TIA

Greg


Bernie Deitrick

Favorites.xla
 
Greg,

Leave the line you want to change alone. Instead, change

.Caption = "&" & lCtlCnt & " " & Cell.Text

To:

.Caption = "&" & IIf(lCtlCnt 9, Chr(lCtlCnt + 87), lCtlCnt) & " " &
Cell.Text

Also change the line

If Application.CountA(rFavs) = 9 Then

to

If Application.CountA(rFavs) = 15 Then

I still haven't figured out the problem with the single file not showing up,
but will work on that tomorrow.

HTH,
Bernie
MS Excel MVP


"GregR" wrote in message
oups.com...
Dick Krusleika, has an add-in, favorites.xla that adds a favorite list
to the File Menu. It limits the list to 9 files, which I have changed
to 15 files and thus, this line in the add-in fails to open any files
10 - 15:

With CommandBars.ActionControl
'Try to open the file
sCap = HandleAmp(Right(.Caption, Len(.Caption) - 3), _ False)
On Error Resume Next
Set wb = Workbooks.Open(sCap)
On Error GoTo 0

I need an or statement, such as:

Or sCap = HandleAmp(Right(.Caption, Len(.Caption) - 4), False)

but it doesn't work. How do I make it work? TIA

Greg




GregR

Favorites.xla
 
Bernie, not sure what you mean by "single file not showing up,". All 15
of my files did show up in the Favorites menu, I just couldn't open 10
- 15,because of the:

sCap = HandleAmp(Right(.Caption, Len(.Caption) - 3), _ False)

The -3 would remove &0[space] and would work fine, but for &00[space],
it would ask if I wanted to search for the file and not open, and thus
the -4, which I was trying to incorporate, which if I changed the above
to:

sCap = HandleAmp(Right(.Caption, Len(.Caption) - 4), _ False), files
10 - 15 would open but not 1 - 9.

Not sure I needed to clarify, but I hope it helps.

Greg


Bernie Deitrick

Favorites.xla
 
Greg,

Then try code that handles both the 3 and 4 by looking for the space:

sCap = HandleAmp(Mid(.Caption, Instr(1, .Caption, " ")+1,Len(.Caption)), _
False)

What I meant by a single file not showing up is that if you have only one
file in your favorites, it doesn't show up. Not a problem when you have 15
files.

HTH,
Bernie
MS Excel MVP


"GregR" wrote in message
oups.com...
Bernie, not sure what you mean by "single file not showing up,". All 15
of my files did show up in the Favorites menu, I just couldn't open 10
- 15,because of the:

sCap = HandleAmp(Right(.Caption, Len(.Caption) - 3), _ False)

The -3 would remove &0[space] and would work fine, but for &00[space],
it would ask if I wanted to search for the file and not open, and thus
the -4, which I was trying to incorporate, which if I changed the above
to:

sCap = HandleAmp(Right(.Caption, Len(.Caption) - 4), _ False), files
10 - 15 would open but not 1 - 9.

Not sure I needed to clarify, but I hope it helps.

Greg




GregR

Favorites.xla
 
Bernie, thank you very much

Greg



All times are GMT +1. The time now is 03:18 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com