VBScript related - Excel

1. Excel sample

Public Const privateKey As String = "c:\Programs\RBP Server Manager\path\private.ppk"

 

Public Const puttyPath As String = "c:\Programs\RBP Server Manager\path\PUTTY.EXE"

Public Const winSCPPath As String = "C:\Programs\Winscp_Testlab\WinSCP\WinSCP.exe"

 

Sub runPutty()

Dim puttyPath, privateKey, account, server

account = Cells(ActiveCell.Row, 3)

server = Cells(ActiveCell.Row, 2)

Call Shell("""" & puttyPath & """" & " -i " & """" & privateKey & """ " & account & "@" & server, vbNormalFocus)

End Sub

 

Sub runWinSCP()

Dim account, server

account = Cells(ActiveCell.Row, 3)

server = Cells(ActiveCell.Row, 2)

Call Shell(winSCPPath & " scp://" & account & "@" & server & ":22 /privatekey=""" & privateKey & """", vbNormalFocus)

End Sub

 

 2. get value

cell(1,1).VALUE

cell(1,1).TEXT

VALUE 属性获取是单元格的真实值,即实际结果。

TEXT 属性获取的是单元格的显示值,就是单元格里显示出来的值。

 

你可能感兴趣的:(VBScript)