Closed Thread
Results 1 to 5 of 5

Hyperlink, RDP file, Registered Program

Hybrid View

  1. #1
    Registered User
    Join Date
    01-05-2007
    Posts
    2

    Hyperlink, RDP file, Registered Program

    Hi all;

    I'm attempting to create a hyperlink to a RDP file to launch Remote Desktop Connection. The following occurs:
    • If I link directly to a file (say, C:\test.rdp), I receive an alert stating "No Program is registered to open this file"
    • If I link directly to Remote Desktop Connection (%windir%\system32\mstsc.exe), I am successful at launching RDC, but not with the parameters of a target file.
    • If I try to add the parameter of a file (%windir%\system32\mstsc.exe -edit "(file location)" OR %windir%\system32\mstsc.exe "(file location)" ), I receive an alert, "Cannot open the specified file"

    The last example is a bit perplexing as the same syntax will work in a shortcut anywhere on my machine.

    Was wondering if anybody is aware of a workaround, add-on, etc. that could resolve this problem. Thanks.

  2. #2
    Forum Expert dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003, 2007 & 2016 365
    Posts
    4,867

    Smile

    Good afternoon wvmurph

    Not sure if this will work, but you could try forcing it to open under the registered Windows application by using this API. It's never let me down yet!

    Private Declare Function ShellExecute Lib "shell32.dll" _
     Alias "ShellExecuteA" (ByVal hWnd As Long, ByVal lpOperation As String, _
     ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, _
     ByVal nShowCmd As Long) As Long
    
    Sub test()
    ShellExecute 0, vbNullString, "test.rdp", vbNullString, "C:\", 1
    End Sub
    HTH

    DominicB
    Please familiarise yourself with the rules before posting. You can find them here.

  3. #3
    Registered User
    Join Date
    01-05-2007
    Posts
    2
    That seems to have done the trick. Thanks.

  4. #4
    Registered User
    Join Date
    12-07-2009
    Location
    45th parallel, 100 miles from the Pacific Ocean
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: Hyperlink, RDP file, Registered Program

    Hope its ok to revisit this topic from a couple of years back:

    I have the same objective: create a hyperlink that opens up an .RDP file. I was able to invoke the mstsc.exe using the standard hyperlink dialogue but what i really want is to invoke the mstsc.exe /admin to open a certain RDP file.

    I tried inserting the API code from DominicB into a VB object via the developer pane but its not working and i lack experience in this area.

    here's what i put in the object for my worksheet:

    Private Declare Function ShellExecute Lib "shell32.dll" _
    Alias "ShellExecuteA" (ByVal hWnd As Long, ByVal lpOperation As String, _
    ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, _
    ByVal nShowCmd As Long) As Long

    Sub test()
    ShellExecute 0, vbNullString, "SanAnt47.rdp", vbNullString, "C:\Documents and Settings\myuser\Desktop\RDPs", 1
    End Sub

    Private Sub Worksheet_Activate()

    End Sub

    Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)

    End Sub

    Private Sub Worksheet_SelectionChange(ByVal Target As Range)

    End Sub

    Am I going about this all wrong?

    Where do i put the API in and how must i edit it?

    Also I need to use the console switch /admin with the mstsc.exe to make this work.

    Any help is appreciated!

  5. #5
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Hyperlink, RDP file, Registered Program

    Welcome to the forum, poonslang.

    Please take a few minutes to read the forum rules, then start your own thread with your code enclosed in code tags.

    Thanks.
    Entia non sunt multiplicanda sine necessitate

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1