How do you open a .lnk

gr8_big_geek

New Member
Joined
Feb 18, 2009
Messages
41
Hello all,

I am needing to open shortcut's in different places on my computer. I've located this thread:

http://www.mrexcel.com/forum/showthread.php?p=1498822

That seems okay but I'm not trying to open a shortcut from the desktop (rather, I need to open it from anywhere on the C:\ drive USA). The reason I need to open the shortcut is because the shortcut is a mute toggle.

(it uses nircmd.exe and has the following in the .lnk path in order to mute/unmute when the shortcut is clicked: "C:\VR_MAIN\Confirmation_Commands\nircmd\nircmd.exe" mutesysvolume 2 microphone)

To open a program I use:

sub program_execute()
Dim strRoboappPath As String, varProc As Variant
On Error Resume Next
strRoboappPath = "C:\Program Files (x86)\Microsoft Office\Office12\EXCEL.exe" 'path here
varProc = Shell(strRoboappPath, 1)
End Sub

I have messed around with the (program opening) coding but cannot seem to get a .lnk to trigger using it!! ARG! Also, I've played around with the above link to help me open a .lnk file but with no such luck.

Any and/or all assistance would be wonderful.

Thanks in advance,

Your Geek~
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Hello gr8_big_geek,

This macro will open a file or shortcut. Be sure to include the extension with the file name. If it is a shortcut then add ".lnk" to the file name event it has another extension. Change the file path and file name to what you will be using.
Rich (BB code):
Sub OpenFile()

  Dim FileName As Variant
  Dim FolderItem As Object
  Dim FolderPath As Variant
  Dim oFolder As Object
  Dim oShell As Object
  
    FolderPath = "C:\Documents and Settings\Admin.ADMINS\Desktop"
    FileName = "Solitaire.lnk"
    
      Set oShell = CreateObject("Shell.Application")
      Set FolderItem = oShell.Namespace(FolderPath).ParseName(FileName)
    
      FolderItem.Verbs.Item(0).DoIt
    
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,548
Messages
6,179,451
Members
452,915
Latest member
hannnahheileen

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