需要Excel宏才能将VNC打开到在活动单元格中指定的计算机名称(Need Excel macro to open VNC to a machine name specified in the Act

编程入门 行业动态 更新时间:2024-10-28 06:23:35
需要Excel宏才能将VNC打开到在活动单元格中指定的计算机名称(Need Excel macro to open VNC to a machine name specified in the Active Cell)

我正在尝试创建并运行Excel宏,这将打开VNC查看器,然后连接到打开的工作簿的活动单元中指定的计算机名称。

如果我手动将特定的机器名称放入引号中(如工作示例所示),它将按照我想要的操作,但我需要用户突出显示一个单元格,运行宏并且VNC将打开,就像下面的工作示例一样。

工作示例:


Sub VNC() Shell ("C:\Program Files\uvnc bvba\UltraVNC\vncviewer.exe H112-R2S2") End Sub

非工作示例:


Sub VNC() Dim txt As String txt = ActiveCell.Value RetVal = Shell("C:\Program Files\uvnc bvba\UltraVNC\vncviewer.exe " & txt) End Sub

I am trying to create and run an Excel macro, that will open VNC Viewer, and then connect to the Machine name that is specified in the Active Cell of the open Workbook.

If I manually put the specific machine name into the quotes (shown in Working Example), it will do what I want, but I need the user to highlight a cell, run the macro and the VNC will open just like in the working example below.

Working Example:


Sub VNC() Shell ("C:\Program Files\uvnc bvba\UltraVNC\vncviewer.exe H112-R2S2") End Sub

NON-Working Example:


Sub VNC() Dim txt As String txt = ActiveCell.Value RetVal = Shell("C:\Program Files\uvnc bvba\UltraVNC\vncviewer.exe " & txt) End Sub

最满意答案

这有点奇怪。 如果先创建字符串并传入while字符串,会发生什么情况?

Sub VNC() Dim txt As String txt = "C:\Program Files\uvnc bvba\UltraVNC\vncviewer.exe " & ActiveCell.Value RetVal = Shell(txt) End Sub

Thats a bit strange. What happens if you create the string first and pass in the while string?

Sub VNC() Dim txt As String txt = "C:\Program Files\uvnc bvba\UltraVNC\vncviewer.exe " & ActiveCell.Value RetVal = Shell(txt) End Sub

更多推荐

本文发布于:2023-07-21 09:41:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1209030.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:能将   开到   单元格   名称   计算机

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!