enable events from shortcut

davidam

Active Member
Joined
May 28, 2010
Messages
497
Office Version
  1. 2021
Platform
  1. Windows
Hello Everyone,
I have used something liek the following to create 2 shortcuts that open a file:
Rich (BB code):
<TABLE style="WIDTH: 48pt; BORDER-COLLAPSE: collapse" border=0 cellSpacing=0 cellPadding=0 width=64 x:str><COLGROUP><COL style="WIDTH: 48pt" width=64><TBODY><TR style="HEIGHT: 13.2pt" height=18><TD style="BORDER-BOTTOM: #ebe9ed; BORDER-LEFT: #ebe9ed; BACKGROUND-COLOR: transparent; WIDTH: 48pt; HEIGHT: 13.2pt; BORDER-TOP: #ebe9ed; BORDER-RIGHT: #ebe9ed" height=18 width=64>Public Sub Shortcut2()</TD></TR><TR style="HEIGHT: 13.2pt" height=18><TD style="BORDER-BOTTOM: #ebe9ed; BORDER-LEFT: #ebe9ed; BACKGROUND-COLOR: transparent; HEIGHT: 13.2pt; BORDER-TOP: #ebe9ed; BORDER-RIGHT: #ebe9ed" height=18>Dim WSHShell As Object</TD></TR><TR style="HEIGHT: 13.2pt" height=18><TD style="BORDER-BOTTOM: #ebe9ed; BORDER-LEFT: #ebe9ed; BACKGROUND-COLOR: transparent; HEIGHT: 13.2pt; BORDER-TOP: #ebe9ed; BORDER-RIGHT: #ebe9ed" height=18>Set WSHShell = CreateObject("WScript.Shell")</TD></TR><TR style="HEIGHT: 13.2pt" height=18><TD style="BORDER-BOTTOM: #ebe9ed; BORDER-LEFT: #ebe9ed; BACKGROUND-COLOR: transparent; HEIGHT: 13.2pt; BORDER-TOP: #ebe9ed; BORDER-RIGHT: #ebe9ed" height=18></TD></TR><TR style="HEIGHT: 13.2pt" height=18><TD style="BORDER-BOTTOM: #ebe9ed; BORDER-LEFT: #ebe9ed; BACKGROUND-COLOR: transparent; HEIGHT: 13.2pt; BORDER-TOP: #ebe9ed; BORDER-RIGHT: #ebe9ed" height=18>Dim DesktopPath As String</TD></TR><TR style="HEIGHT: 13.2pt" height=18><TD style="BORDER-BOTTOM: #ebe9ed; BORDER-LEFT: #ebe9ed; BACKGROUND-COLOR: transparent; HEIGHT: 13.2pt; BORDER-TOP: #ebe9ed; BORDER-RIGHT: #ebe9ed" height=18>DesktopPath = WSHShell.SpecialFolders("Desktop")</TD></TR><TR style="HEIGHT: 13.2pt" height=18><TD style="BORDER-BOTTOM: #ebe9ed; BORDER-LEFT: #ebe9ed; BACKGROUND-COLOR: transparent; HEIGHT: 13.2pt; BORDER-TOP: #ebe9ed; BORDER-RIGHT: #ebe9ed" height=18>CreateShortcut DesktopPath & "\Program.lnk", WSHShell.ExpandEnvironmentStrings(Range("B2").Value & "\Location\Program.xls"), WSHShell.ExpandEnvironmentStrings("%windir%"), (Range("B2").Value & "\Location\Shortcut.bmp")</TD></TR><TR style="HEIGHT: 13.2pt" height=18><TD style="BORDER-BOTTOM: #ebe9ed; BORDER-LEFT: #ebe9ed; BACKGROUND-COLOR: transparent; HEIGHT: 13.2pt; BORDER-TOP: #ebe9ed; BORDER-RIGHT: #ebe9ed" height=18>CreateShortcut Range("B2").Value & "\CLIPr\Canadian Life Income Planr.lnk", WSHShell.ExpandEnvironmentStrings(Range("B2").Value & "\Location\Program.xls"), WSHShell.ExpandEnvironmentStrings("%windir%"), (Range("B2").Value & "\Location\Shortcut.bmp")</TD></TR><TR style="HEIGHT: 13.2pt" height=18><TD style="BORDER-BOTTOM: #ebe9ed; BORDER-LEFT: #ebe9ed; BACKGROUND-COLOR: transparent; HEIGHT: 13.2pt; BORDER-TOP: #ebe9ed; BORDER-RIGHT: #ebe9ed" height=18>Set WSHShell = Nothing</TD></TR><TR style="HEIGHT: 13.2pt" height=18><TD style="BORDER-BOTTOM: #ebe9ed; BORDER-LEFT: #ebe9ed; BACKGROUND-COLOR: transparent; HEIGHT: 13.2pt; BORDER-TOP: #ebe9ed; BORDER-RIGHT: #ebe9ed" height=18></TD></TR><TR style="HEIGHT: 13.2pt" height=18><TD style="BORDER-BOTTOM: #ebe9ed; BORDER-LEFT: #ebe9ed; BACKGROUND-COLOR: transparent; HEIGHT: 13.2pt; BORDER-TOP: #ebe9ed; BORDER-RIGHT: #ebe9ed" height=18>End Sub</TD></TR></TBODY></TABLE>
My question is this: I would like Application.EnableEvents = True to run if the shortcut is clicked...can I do this?
Thank you
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
If you mean you want the shortcuts to open the worksheets and enable events I don't think so.

Of course you could enable events in the code that makes the shortcut but I don't think that's what you want.
 
Upvote 0
Yes, I wanted to enable events by clicking the shortcut...not when I ran the above code. I put the code in because I thought this would be the place to create code that would trigger when using the shortcut...but it seems that I will not be able to do this.
Thanks Norie
 
Upvote 0

Forum statistics

Threads
1,224,552
Messages
6,179,487
Members
452,917
Latest member
MrsMSalt

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top