使用Script Control在工程->引用 裡新增Microsoft Script Controls 1.0程式碼如下Private Sub Command1_Click() Dim vbs As String Open "VBS的檔案路徑" For Input As #1 vbs = StrConv(InputB(LOF(1), 1), vbUnicode) Close #1 Dim s As ScriptControl Set s = CreateObject("ScriptControl") s.Language = "VBScript" s.AllowUI = True"新增程式碼並執行 s.AddCode vbs s.Run "vbs中的過程名" Set s = NothingEnd Sub其中 VBS的檔案路徑 和 vbs中的過程名 自己替換
使用Script Control在工程->引用 裡新增Microsoft Script Controls 1.0程式碼如下Private Sub Command1_Click() Dim vbs As String Open "VBS的檔案路徑" For Input As #1 vbs = StrConv(InputB(LOF(1), 1), vbUnicode) Close #1 Dim s As ScriptControl Set s = CreateObject("ScriptControl") s.Language = "VBScript" s.AllowUI = True"新增程式碼並執行 s.AddCode vbs s.Run "vbs中的過程名" Set s = NothingEnd Sub其中 VBS的檔案路徑 和 vbs中的過程名 自己替換