Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA to open a shortcut to a workbook
Is there a way to use VBA to "open" shortcuts to workbooks?
For example, Book1.xls is in Folder A There is a "shortcut" to Book1.xls in Folder B Book2.xls is a workbook in Folder B When opening Book2.xls, what VBA would look for shortcuts in the Folder B and open those files? Thanks, Walden |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA to open a shortcut to a workbook
Sub LoopFolders()
Dim oFSO As Object Dim Folder As Object Dim Files As Object Dim file As Object Set oFSO = CreateObject("Scripting.FileSystemObject") Set Folder = oFSO.GetFolder("c:\Test") For Each file In Folder.Files If file.Type Like "*Shortcut*" Then Workbooks.Open Filename:=file.Path End If Next file Set oFSO = Nothing End Sub -- --- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Walden2" wrote in message s.com... Is there a way to use VBA to "open" shortcuts to workbooks? For example, Book1.xls is in Folder A There is a "shortcut" to Book1.xls in Folder B Book2.xls is a workbook in Folder B When opening Book2.xls, what VBA would look for shortcuts in the Folder B and open those files? Thanks, Walden |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA to open a shortcut to a workbook
All you will need to do is in Book2.xls
Alt-F11 and in the ThisWorkbook Code Window paste in: Private Sub Workbook_Open() LoopFolders ' Bob's code posted in a Standard module (assumed) End Sub Jim May "Walden2" wrote: Is there a way to use VBA to "open" shortcuts to workbooks? For example, Book1.xls is in Folder A There is a "shortcut" to Book1.xls in Folder B Book2.xls is a workbook in Folder B When opening Book2.xls, what VBA would look for shortcuts in the Folder B and open those files? Thanks, Walden |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA to open a shortcut to a workbook
This worked great. Thanks much.
Walden On Oct 6, 7:48 am, "Bob Phillips" wrote: Sub LoopFolders() Dim oFSO As Object Dim Folder As Object Dim Files As Object Dim file As Object Set oFSO = CreateObject("Scripting.FileSystemObject") Set Folder = oFSO.GetFolder("c:\Test") For Each file In Folder.Files If file.Type Like "*Shortcut*" Then Workbooks.Open Filename:=file.Path End If Next file Set oFSO = Nothing End Sub -- --- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Walden2" wrote in message s.com... Is there a way to use VBA to "open" shortcuts to workbooks? For example, Book1.xls is in Folder A There is a "shortcut" to Book1.xls in Folder B Book2.xls is a workbook in Folder B When opening Book2.xls, what VBA would look for shortcuts in the Folder B and open those files? Thanks, Walden- Hide quoted text - - Show quoted text - |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
shortcut has change or move so this shortcut can not open | Excel Worksheet Functions | |||
Using a Windows Shortcut to Open to Specific Sheet in Workbook | Excel Discussion (Misc queries) | |||
Open a specific workbook...find value from other open workbook and then insert cells values in cell next to it. | Excel Programming | |||
Write a Shortcut to Open Excel Workbook at a Specific Sheet | Excel Programming | |||
Open a new instance with a shortcut | Excel Programming |