Distribute an excel workbook shortcut

M

Mike K

Oh Wise Ones,
Please forgive me if this is not the proper forum
for this question but I'm not sure where to post it, and I feel some of you
may have encountered this before. I have an excel spreadsheet that I would
like to place a shortcut to on peoples desktops with the file to open
readonly. Has anyone done this before? I guess it would require some type of
batch file. I would send it as a link in Outlook and the recipients would
double-click on the attachment, then the shortcut would be installed to their
desktop to be opened readonly when started. It's a local office so I know
everyone. Yes everyone has access to the network location.

File "Safety reporting form"
Location S:\files\shared\safety\Safety reporting form.xla
 
P

Peter T

See this link

http://vbnet.mvps.org/index.html?code/shell/desktoplink.htm

Include all the declarations at the top of the module and the following
functions
CreateDesktopLink
GetSpecialFolder
TrimNull

' try this to test it
Sub test()
Dim sFile As String
Dim sPathToDesktop As String

sFile = ActiveWorkbook.FullName ' a previously saved workbook

' n/a in Excel 2000, replace app.hwnd with GetDeskTopWindow (search for it)
sPathToDesktop = GetSpecialFolder(Application.hWnd, CSIDL_DESKTOPDIRECTORY)

CreateDesktopLink sFile, sPathToDesktop
End Sub


If you need to cater for Excel 2000 add this API
Private Declare Function GetDesktopWindow Lib "user32.dll" () As Long

and change Application.hwnd to GetDesktopWindow

Regards,
Peter T
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top