Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default ActiveWorkbook.AddToFavorites

Hi -

Anyway to disable .AddToFavorites?

I have a a macro that generates the end-of-month runs. It generates anywhere
from 2 to 70 different workbooks. If there are more, it can "overrun" the
users "favorites" folder.

Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default ActiveWorkbook.AddToFavorites

This may sound like a lot of work but it is a solution. The problem is you
are limited to the number of Files in a folder. If a user has too many files
in his favorites directory you can't add any more. There are two solutions.
Delete some files from the favorites directory or Add a new Subfolder to the
Favorites. The code below adds a new Subfolder in the persons favorites
called End Of Month. Then after the addtofavorite is executed it moves the
new shortcut to the End of Month Subfolder.

Sub MovetoNewFolder()
Const Addfolder = "End of Month"
Homedrive = Environ("Homedrive")
HomePath = Environ("HOMEPATH")
Favorite = Homedrive & HomePath & "My documents\Favorites"
EndofMonth = Favorite & "\" & Addfolder
Set FSOobj = CreateObject("Scripting.FileSystemObject")

'Test if End of Month folder exists
If Not FSOobj.folderexists(EndofMonth) Then
'create folder end of Month
Set FavoriteFolder = FSOobj.getfolder(Favorite)
FavoriteFolder.subfolders.Add Addfolder
End If

'Save in Faroites
ThisWorkbook.AddToFavorites
'Get new filename
FName = Dir(Favorite & "\" & ThisWorkbook.Name & "*.*")
'set object to new filename
Set ShortCut = FSOobj.getfile(Favorite & "\" & FName)
'move to subfolder
ShortCut.Move EndofMonth & "\" & FName

End Sub

"MeistersingerVonNurnberg" wrote:

Hi -

Anyway to disable .AddToFavorites?

I have a a macro that generates the end-of-month runs. It generates anywhere
from 2 to 70 different workbooks. If there are more, it can "overrun" the
users "favorites" folder.

Thanks

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default ActiveWorkbook.AddToFavorites


Hi -

I think the real problem I am having is this: when I execute the wb.save a
bunch of times, it puts a shortcut into "Recent Documents", and that is what
I was referring to regarding "overrunning" favorites. I am reaching no limit;
it just puts so many of the shortcuts there, a user can't see other docs they
were working on.

In other words, after executing my process, under start-documents, there
will be lots of versions of my generated wb.

So, from your post 2 things: 1. delete the shortcuts myself - maybe if some
tolerance is reached, start purging; 2. manage the shortcuts myself - perhaps
w folders - I like this idea you presented very much bc the visibility into
the created wb's is there, and a user can ignore as they desire.

Thanks Joel!


"Joel" wrote:

This may sound like a lot of work but it is a solution. The problem is you
are limited to the number of Files in a folder. If a user has too many files
in his favorites directory you can't add any more. There are two solutions.
Delete some files from the favorites directory or Add a new Subfolder to the
Favorites. The code below adds a new Subfolder in the persons favorites
called End Of Month. Then after the addtofavorite is executed it moves the
new shortcut to the End of Month Subfolder.

Sub MovetoNewFolder()
Const Addfolder = "End of Month"
Homedrive = Environ("Homedrive")
HomePath = Environ("HOMEPATH")
Favorite = Homedrive & HomePath & "My documents\Favorites"
EndofMonth = Favorite & "\" & Addfolder
Set FSOobj = CreateObject("Scripting.FileSystemObject")

'Test if End of Month folder exists
If Not FSOobj.folderexists(EndofMonth) Then
'create folder end of Month
Set FavoriteFolder = FSOobj.getfolder(Favorite)
FavoriteFolder.subfolders.Add Addfolder
End If

'Save in Faroites
ThisWorkbook.AddToFavorites
'Get new filename
FName = Dir(Favorite & "\" & ThisWorkbook.Name & "*.*")
'set object to new filename
Set ShortCut = FSOobj.getfile(Favorite & "\" & FName)
'move to subfolder
ShortCut.Move EndofMonth & "\" & FName

End Sub

"MeistersingerVonNurnberg" wrote:

Hi -

Anyway to disable .AddToFavorites?

I have a a macro that generates the end-of-month runs. It generates anywhere
from 2 to 70 different workbooks. If there are more, it can "overrun" the
users "favorites" folder.

Thanks

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default ActiveWorkbook.AddToFavorites

I don't think they are going into recent documents. In your home directory
under My documents \Favorite is the location where they are going. You can
also see these files if you open an Internet Explorer and look under Favorite.

"MeistersingerVonNurnberg" wrote:


Hi -

I think the real problem I am having is this: when I execute the wb.save a
bunch of times, it puts a shortcut into "Recent Documents", and that is what
I was referring to regarding "overrunning" favorites. I am reaching no limit;
it just puts so many of the shortcuts there, a user can't see other docs they
were working on.

In other words, after executing my process, under start-documents, there
will be lots of versions of my generated wb.

So, from your post 2 things: 1. delete the shortcuts myself - maybe if some
tolerance is reached, start purging; 2. manage the shortcuts myself - perhaps
w folders - I like this idea you presented very much bc the visibility into
the created wb's is there, and a user can ignore as they desire.

Thanks Joel!


"Joel" wrote:

This may sound like a lot of work but it is a solution. The problem is you
are limited to the number of Files in a folder. If a user has too many files
in his favorites directory you can't add any more. There are two solutions.
Delete some files from the favorites directory or Add a new Subfolder to the
Favorites. The code below adds a new Subfolder in the persons favorites
called End Of Month. Then after the addtofavorite is executed it moves the
new shortcut to the End of Month Subfolder.

Sub MovetoNewFolder()
Const Addfolder = "End of Month"
Homedrive = Environ("Homedrive")
HomePath = Environ("HOMEPATH")
Favorite = Homedrive & HomePath & "My documents\Favorites"
EndofMonth = Favorite & "\" & Addfolder
Set FSOobj = CreateObject("Scripting.FileSystemObject")

'Test if End of Month folder exists
If Not FSOobj.folderexists(EndofMonth) Then
'create folder end of Month
Set FavoriteFolder = FSOobj.getfolder(Favorite)
FavoriteFolder.subfolders.Add Addfolder
End If

'Save in Faroites
ThisWorkbook.AddToFavorites
'Get new filename
FName = Dir(Favorite & "\" & ThisWorkbook.Name & "*.*")
'set object to new filename
Set ShortCut = FSOobj.getfile(Favorite & "\" & FName)
'move to subfolder
ShortCut.Move EndofMonth & "\" & FName

End Sub

"MeistersingerVonNurnberg" wrote:

Hi -

Anyway to disable .AddToFavorites?

I have a a macro that generates the end-of-month runs. It generates anywhere
from 2 to 70 different workbooks. If there are more, it can "overrun" the
users "favorites" folder.

Thanks

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
ActiveWorkbook.SaveAs franks Excel Programming 6 August 6th 07 10:04 PM
ActiveWorkbook is nothing in Workbook_Open [email protected] Excel Programming 3 September 13th 06 04:32 PM
ActiveWorkbook.RefreshAll Matt Cromer[_2_] Excel Programming 3 July 24th 06 08:45 PM
ActiveWorkBook Pete Excel Discussion (Misc queries) 3 May 9th 05 04:14 PM
activeworkbook problems texastig Excel Programming 1 February 23rd 05 03:01 AM


All times are GMT +1. The time now is 09:55 PM.

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

About Us

"It's about Microsoft Excel"