我正在尝试创建并运行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 SubThats 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更多推荐
发布评论