Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dynamic File Shortcut

Status
Not open for further replies.

blindlemonray

Technical User
Nov 24, 2003
130
GB
Does anyone know if it is possible create a dynamic file shortcut? I have a file that is output with a new date every day and would like users to have a short cut to it, but the file is output with current date on it.

Any help appreciated.
 
We have solved a similar problem by adding a shortcut to the folder that the daily changing file is in to everyone's desktop. Now, you just have to update that folder by replacing the file.
 
In other words, no, you can not create a dynamically changing shortcut - after all a shortcut is a pointer, and it must point to something explicit (like a filename). However, a shortcut to a folder - as mechman suggests - is a possible solution. The folder name remains constant (thus the pointer is explicit), but the file(s) in it can dynamically change.

Depending on a couple of factors, you could do a VBA solution. I have a similar situation in that I have a folder that contains ONE file. That file is also constantly changing, its contents being overwritten and a new filename given to it. The process of giving it a new filename (via SaveAs) also moves the original to a backup folder.

Thus there is only ever ONE file (but constantly changing its name) in that folder. I have the following fired by a shortcut key (Alt-n). I press Alt-n and that file (whatever its current name) is opened.
Code:
Sub GetCurrentFile()
Const myPath As String = "c:\zzz\NewDoc\"
Dim file
file = Dir(myPath & "*.doc")
   Do While file <> ""
      Documents.Open FileName:=myPath & file
      file = Dir
   Loop
End Sub
It is also possible to have logic that could determine the last created file in a folder, and open that one. This requires a bit more logic and uses FileSystemObject.

Gerry
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top