ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Desktop Shortcut (https://www.excelbanter.com/excel-programming/296403-desktop-shortcut.html)

Michael Rekas[_2_]

Desktop Shortcut
 
Hi there

Is it possible to use VBA to generate desktop shortcut to a workbook?

Thanks

Michael

AA2e72E[_2_]

Desktop Shortcut
 
If you have Scripting enabled, refer to

http://www.rb-ad.dircon.co.uk/rob/ex...velop/index.ht

Otherwise, if you have the appropriate DLLs, refer to

http://support.microsoft.com/default...NoWebContent=1

Melanie Breden

Desktop Shortcut
 
Hi Michael,

Michael Rekas wrote:
Is it possible to use VBA to generate desktop shortcut to a workbook?


set a reference on "Windows Scripting Host Object Model"-library

Sub DesktopShortcut()
Dim WSHShell As IWshShell
Set WSHShell = New IWshShell_Class

With WSHShell.CreateShortcut( _
WSHShell.SpecialFolders("Desktop") & "\" & ActiveWorkbook.Name & ".lnk")
.TargetPath = ActiveWorkbook.FullName
.Save
End With
End Sub

--
Mit freundlichen Grüssen

Melanie Breden
- Microsoft MVP für Excel -

http://excel.codebooks.de (Das Excel-VBA Codebook)


Michael Rekas[_2_]

Desktop Shortcut
 
Thank you for the replies. I like the "Windows Scripting Host Object
Model" code.

However is it possible to automatically set the reference to the
library?

Michael


On Tue, 27 Apr 2004 09:57:21 +0200, Michael Rekas
wrote:

Hi there

Is it possible to use VBA to generate desktop shortcut to a workbook?

Thanks

Michael



Melanie Breden

Desktop Shortcut
 
Hallo Michael,

Michael Rekas wrote:
Thank you for the replies. I like the "Windows Scripting Host Object
Model" code.

However is it possible to automatically set the reference to the
library?



with the following defining no reference must be set:

Dim WSHShell As Object
Set WSHShell = CreateObject("WScript.Shell")

--
Mit freundlichen Grüssen

Melanie Breden
- Microsoft MVP für Excel -

http://excel.codebooks.de (Das Excel-VBA Codebook)


Michael Rekas[_2_]

Desktop Shortcut
 
Hello Melanie

Excellent! Works perfectly.

Thanks

Michael

On Tue, 27 Apr 2004 19:06:23 +0200, "Melanie Breden"
wrote:

Hallo Michael,

Michael Rekas wrote:
Thank you for the replies. I like the "Windows Scripting Host Object
Model" code.

However is it possible to automatically set the reference to the
library?



with the following defining no reference must be set:

Dim WSHShell As Object
Set WSHShell = CreateObject("WScript.Shell")




All times are GMT +1. The time now is 06:51 PM.

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