Executing UltraVNC shortcuts from excel

L

Legacy 87448

Guest
Hello. I work at a hospital where I have an excel spreadsheet of all inventory (computers/printers/etc). I use UltraVNC to remotely connect to my computer stations and troubleshoot. What I would like to have is a link or macro that would allow me to click the name of the computer I want to connect to in Excel and open up UltraVNC with the argument <computername>.

If you run a shortcut 'vnc.lnk' with a target "path\VNCviewer.exe <computername>" (without quotes or brackets), VNC will open and automatically attempt to connect to the computer with that name.

So I need to execute VNC.exe with a parameter to automatically input the workstations' name in the corresponding cell.

I've attempted a hyperlink which does work and seems like the easiest thing, however I get about 4 popups (warnings about macros, then viruses, then a popup asking where i want to 'move' the shortcut to, then where i want to 'copy' it to). If I cancel or ok all these VNC will popup and ask for a password.

I've also attempted a batch file which then runs the VNC shortcut. This also works, but the problem is that I have 150+ workstations and I don't want a separate shortcut and batch for each one. I want a single vnc.exe which I can place the computer name into.

I hope this makes sense. Thanks so much for any help! I'm not great with VB but I'm trying to learn. I'm willing to try whatever I need.
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
Check out the VBA helpfile for "Shell Function", which will allow you to execute .exe's. You can also feed certain parameters, so I'll bet you can load the pc name based on a cell value or InputBox, and eliminate your prompts.

Hope that helps,

Smitty
 
Upvote 0
Thanks! So this is what I've got so far, but I'm still not able to accomplish what I want, and I'm starting to think it's not possible.

Code:
Public 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 VNC()
    Dim strFile As String
    Dim strAction As String
    Dim strParameter As String
    Dim lngErr As Long

    ' Edit this:
    strFile = "c:\vnc.exe"  ' the file you want to open/etc.
    strAction = "OPEN"  ' action might be OPEN, NEW or other, depending on what you need to do
    strParameters = "computername"
    lngErr = ShellExecute(0, strAction, strFile, strParameters, "", 0)

    ' optionally, add code to test lngErr

End Sub

This code works if I click "tools-macros-run macro". It will open VNC with whatever computer name I have under 'strParameters'. The problem is, I can't change that parameter for each cell. I want to find a way to pull the computer name value from a cell but I don't know what code to put in VB to search value 'A1' in excel. Putting A1 makes it literally use A1 as the computer name. Once I get A1 in I need a way to run the macro with a 'change of cell' or something similar. I could have a cell containing 0's and if I change a 0 to a 1 the macro for that row could run. That's just one idea I had because I've read that a function cannot call a macro, neither can I assign a macro to a hyperlink (which is what i'd prefer). Thanks for the help.
 
Upvote 0
i used ultravnc before and i found that once connected to a remote machine you can right click the Icon in the system tray and save the connection information to a file, if you do this for each system you could just create hyperlinks to these shortcuts.

HTH
 
Upvote 0
Thanks Shippey. I was going to use that idea as a last resort just because I wanted everything to stay in Excel, but thanks. I'll probably have to end up going this way.
 
Upvote 0
I know this is a very old thread but I will try my luck here. Been searching online for few days now and can't seem to get the exact answer I am looking for. Shippey121's post works, but what if you have hundreds of IP that you want to put in the list, that would mean saving those connection settings in a folder then hyperlink to them. Aside from that, excel would give warning popup windows about trust connection, you can eliminate this by adjusting the trust center settings though.

Anyone who has ideas how get the VBA working with ultravnc with password?

Thanks so much in advance.
 
Upvote 0

Forum statistics

Threads
1,213,556
Messages
6,114,284
Members
448,562
Latest member
Flashbond

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