How can I encrypt the output of mysqldump using VB.NET? - vb.net

I use this code to create dump files of my database.
Now what I want, if possible, is to encrypt it so that when it is viewed in notepad or anything similar, average users cannot read it.
Call isDirectoryExist()
Call createDbBackupName()
Dim myProcess As Process = New Process
Dim strUser As String = "superadmin"
' MsgBox(" --host=localhost --user='" & strUser & "' --password """ & strDbName & """ -r """ & strPath & newDBName & """ ")
Process.Start("C:/MySQL/bin/mysqldump.exe", " --host=localhost --user='" & strUser & "' --password=1234 """ & strDbName & """ -r """ & strPath & newDBName & """ ")
I also have an option to restore these files. using these codes.
Dim strm As System.IO.Stream
strm = ofpSQL.OpenFile
txtRestore.Text = ofpSQL.FileName.ToString
If Not (strm Is Nothing) Then
Dim dbToRestore As String = ofpSQL.FileName.ToString
Dim myProcess As New Process()
myProcess.StartInfo.FileName = "cmd.exe"
myProcess.StartInfo.UseShellExecute = False
myProcess.StartInfo.WorkingDirectory = "C:\MySQL\bin\"
myProcess.StartInfo.RedirectStandardInput = True
myProcess.StartInfo.RedirectStandardOutput = True
myProcess.Start()
Dim myStreamWriter As StreamWriter = myProcess.StandardInput
Dim mystreamreader As StreamReader = myProcess.StandardOutput
myStreamWriter.WriteLine("mysql -u superadmin --password=1234 """ & strDbName & """ < """ & ofpSQL.FileName.ToString & """ ")
myStreamWriter.Close()
myProcess.WaitForExit()
myProcess.Close()
strm.Close()
End If
Of course, if it encrypted, it has to be decrypted before querying the dump file.
I have no idea what encryption I can do in vb.net and mysql
Anyway, if I happen to know one, I dont know how can i use it.
Any help and input will be very helpful.
Thanks in advance.
I modified my first code
Process.Start("C:/MySQL/bin/mysqldump.exe", " --host=localhost --user='" & strUser & "' --password=1234 """ & strDbName & """ -r """ & strPath & newDBName & """, --cipher /e /a '" & newDBName & "' ")
but the output file contains nothing whatsover. TIA

Change your code to this,
Process.Start("C:/MySQL/bin/mysqldump.exe", " --host=localhost --user='" & strUser & "' --password=1234 """ & strDbName & """ -r """ & strPath & newDBName & """")
Process.WaitForExit()
Process.Start("C:\Windows\System32\cipher.exe", "/e /a '" & strPath & newDBName & "' ")

Related

How to show Windows 10 notification toast from VBA

I'd like to know the easiest way to show notification toast in windows 10 from VBA.
I didn't found a good answer to this. I found a really simple way to create notifications from PowerShell here. But I can't get it to work from VBA because I didn't find a way to execute this in one line using WScript.Shell.
I tried several ways to accomplish that but i didn't succeed. Below you can find my last attempt:
Public Sub Notify_Test()
Dim WsShell As Object: Set WsShell = CreateObject("WScript.Shell")
Dim strCommand As String
strCommand = """powershell.exe"" ^ "
strCommand = strCommand & "[reflection.assembly]::loadwithpartialname(""System.Windows.Forms"")"
strCommand = strCommand & "; [reflection.assembly]::loadwithpartialname(""System.Drawing"")"
strCommand = strCommand & "; $notify = new-object system.windows.forms.notifyicon"
strCommand = strCommand & "; $notify.icon = [System.Drawing.SystemIcons]::Information"
strCommand = strCommand & "; $notify.visible = $true"
strCommand = strCommand & "; $notify.showballoontip(10,""New Chat!"",""You have received New Chat!"",[system.windows.forms.tooltipicon]::None)"
WsShell.Run strCommand
End Sub
I'd like to avoid writing a .ps1 file. Can someone please help me with this question?
Thank you in advance!
UPDATE:
Thanks to #Remko I was able to display the notification.
I did a function to make its use simpler:
Public Function Notify(ByVal title As String, ByVal msg As String, _
Optional ByVal notification_icon As String = "Info", _
Optional ByVal app As String = "excel", _
Optional ByVal duration As Integer = 10)
'Parameters:
' title (str):Notification title
' msg (str):Notification message
' notification_icon (str):Notification icon. Available options are: Info, Error and Warning
' app (str):Process name of app you want to be display in the system tray icon
' duration (int):Duration of notification in seconds
Const PSpath As String = "powershell.exe"
Dim WsShell As Object: Set WsShell = CreateObject("WScript.Shell")
Dim strCommand As String
If notification_icon <> "Info" And notification_icon <> "Error" And notification_icon <> "Warning" Then
notification_icon = "Info"
End If
strCommand = """" & PSpath & """ -Command " & Chr(34) & "& { "
strCommand = strCommand & "Add-Type -AssemblyName 'System.Windows.Forms'"
strCommand = strCommand & "; $notification = New-Object System.Windows.Forms.NotifyIcon"
strCommand = strCommand & "; $path = (Get-Process -id (get-process " & app & ").id).Path"
strCommand = strCommand & "; $notification.Icon = [System.Drawing.Icon]::ExtractAssociatedIcon($path)"
strCommand = strCommand & "; $notification.BalloonTipIcon = [System.Windows.Forms.ToolTipIcon]::" & notification_icon & ""
strCommand = strCommand & "; $notification.BalloonTipText = '" & msg & "'"
strCommand = strCommand & "; $notification.BalloonTipTitle = '" & title & "'"
strCommand = strCommand & "; $notification.Visible = $true"
strCommand = strCommand & "; $notification.ShowBalloonTip(" & duration & ")"
strCommand = strCommand & " }" & Chr(34)
WsShell.Run strCommand, 0, False
End Function
Public Sub Notify_Examples()
Notify "Insert Title Here", "Insert Your Message Here"
Notify "Insert Title Here", "Insert Your Message Here", "Warning"
Notify "Insert Title Here", "Insert Your Message Here", "Error", "outlook"
End Sub
I'd like to make and extra observation. Nothing happens when leave the PSpath = "powershell.exe". I guess this is due to the fact my user is not an admin. I was able to bypass this by copying the powershell.exe to my documents and altering the PSpath to "C:\Users\my_user\Documents\powershell.exe". Maybe this is the case for you too...
If you insist doing this with PowerShell the following code works:
Public Sub Notify_Test()
Dim WsShell As Object: Set WsShell = CreateObject("WScript.Shell")
Dim strCommand As String
strCommand = "powershell.exe -Command " & Chr(34) & "& { "
strCommand = strCommand & "[reflection.assembly]::loadwithpartialname('System.Windows.Forms')"
strCommand = strCommand & "; [reflection.assembly]::loadwithpartialname('System.Drawing')"
strCommand = strCommand & "; $notify = new-object system.windows.forms.notifyicon"
strCommand = strCommand & "; $notify.icon = [System.Drawing.SystemIcons]::Information"
strCommand = strCommand & "; $notify.visible = $true"
strCommand = strCommand & "; $notify.showballoontip(10,'New Chat!','You have received New Chat!',[system.windows.forms.tooltipicon]::None)"
strCommand = strCommand & " }" & Chr(34)
WsShell.Run strCommand
End Sub
It will of course briefly flash a console (powershell) window

Create Statement to run a Microsoft Access Query using Vbscript

What i have so far is a Query that opens the Microsoft Access Application but i would like to open and run a sql query itself and close the application. the query like
SELECT S2iOSGISAcquisitionCSV.Agencia,
S2iOSGISAcquisitionCSV.Mercado,
S2iOSGISAcquisitionCSV.[Nome Produtor],
S2iOSGISAcquisitionCSV.Dispositivo
FROM S2iOSGISAcquisitionCSV;
where can i put that statement ? thank you
Dim sAcc
Dim sFrontEnd
Dim sSec
Dim sUser
Dim objShellDb
Dim sComTxt
Dim rs
sAcc = "C:\Program Files\Microsoft Office 15\root\office15\msaccess.exe"
'"C:\Program Files\Microsoft Office\OFFICE11\msaccess.exe"
sFrontEnd = "C:\Users\User\Desktop\TABELA_DE_DADOS.accdb"
Set objShellDb = CreateObject("WScript.Shell")
'Set rs = createObject("SELECT* FROM S2iOSGISAcquisitionCSV");
sComTxt = chr(34) & sAcc & chr(34) &_
" " & chr(34) & sFrontEnd & chr(34)
if isNull(sSec)=False AND sSec<>"" Then
sComTxt = sComTxt & " /wrkgrp " & chr(34) & sSec & chr(34)
End if
if isNull(sUser)=False AND sUser<>"" Then
sComTxt = sComTxt & " /user " & sUser
End if
objShellDb.Run sComTxt
' rs.Run sComTxt

Async in VB not working as expected

UPDATE:
It looks like the culprit is the status reporting
ffStatus = procFFMPEG.StandardError 'Send standard error to ffStatus
strFFout = ffStatus.ReadLine 'Read every line of output and send to strFFout
It look's like it breaks the async in that part. When commented out, marquee scrollbar behave as expected.
Is there a way to be able to get those data and update status while not breaking async to show marquee progressbar?
ORIGINAL POST
I have similar problem to this question
VB.NET Marquee Progress Until Process Exits
I use the accepted answer and gets to this code
Public Async Sub GoConvert(theVCodec As String, theHeight As String)
Dim theOptions As String, theApp As String, theSourcePath As String, theDestPath As String
Dim theFilename As String, theACodec As String, theFormat As String, theLosslessOpt As String
Dim theNewFilename As String, theNewFileTag As String, theInterlaced As String, theMsg As String
Dim thePreset As String, theCRF As String
Dim ffStatus As StreamReader, strFFout As String
'On Error GoTo Handler
'SET DEFAULT VALUES
theApp = "ffmpeg.exe"
theSourcePath = txtSource.Text
theDestPath = txtOutput.Text & "\"
theACodec = "libmp3lame"
thePreset = "veryfast"
theCRF = "22"
theInterlaced = ""
theNewFileTag = ""
theLosslessOpt = ""
Select Case theVCodec
Case "libx264"
theNewFileTag = "x264"
Case "libxvid"
theNewFileTag = "xvid"
Case "libx265"
theNewFileTag = "x265"
End Select
If cmbUseCodec.Text = "x264 vegas" Then
theACodec = "aac"
theNewFileTag = "x264forVegas"
End If
theMsg = "IF FILE EXISTS, IT WILL BE OVERWRITTEN!" & vbCrLf & vbCrLf & "Please make sure that there is no filename conflict in the destination folder," & vbCrLf & "Encoder will overwrite existing files." _
& vbCrLf & vbCrLf & "Do you want to continue?"
If MessageBox.Show(theMsg, "WARNING!", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) = DialogResult.Yes Then
For i As Integer = 0 To lstSourceFiles.Items.Count - 1
If chkToFileType.CheckedItems.Count <> 0 Then
Dim x As Integer
Dim forVegas As String
For x = 0 To chkToFileType.CheckedItems.Count - 1
theFormat = chkToFileType.CheckedItems(x).ToString
'GET FILENAMES ON FILES LISTBOX
theFilename = lstSourceFiles.Items(i).ToString
theNewFilename = System.IO.Path.GetFileNameWithoutExtension(theFilename)
If chkSameOutputFolder.CheckedItems.Count > 0 Then
theDestPath = Path.GetDirectoryName(theFilename) & "\"
End If
If (theVCodec = "libx265") Then
theCRF = "28"
thePreset = "medium"
End If
If (chkLossLess.CheckedItems.Count > 0) And (theVCodec = "libx265") Then
theLosslessOpt = "-x265-params lossless=1 "
End If
If theFormat = "mp3" Then
'-i "%%a" -qa 0 - map a "%%~na.mp3"
theOptions = " -i " & Chr(34) & theFilename & Chr(34) & " -y -q:a 0 -map a " & Chr(34) & theDestPath & theNewFilename & "." & theFormat & Chr(34)
Else
'PREPARE NEW FILENAME OF CONVERTED FILE
theNewFilename = theNewFilename & "-" & theNewFileTag & "-" & theHeight & "p"
theOptions = " -i " & Chr(34) & theFilename & Chr(34) & " -y -vcodec " & theVCodec
theOptions = theOptions & " -vf " & theInterlaced & "scale=" & Chr(34) & "trunc(oh*a/2)*2:" & theHeight & Chr(34)
If cmbUseCodec.Text = "x264 vegas" Then
forVegas = " -strict experimental -tune fastdecode -pix_fmt yuv420p -b:a 192k -ar 48000"
theOptions = theOptions & " -preset " & thePreset & " -crf " & theCRF & " -acodec " & theACodec & forVegas
theOptions = theOptions & " -threads 4 " & theLosslessOpt & Chr(34) & theDestPath & theNewFilename & "." & theFormat & Chr(34)
Else
theOptions = theOptions & " -b 1750k -preset " & thePreset & " -crf " & theCRF & " -acodec " & theACodec
theOptions = theOptions & " -ac 2 -ab 160k -threads 4 " & theLosslessOpt & Chr(34) & theDestPath & theNewFilename & "." & theFormat & Chr(34)
End If
End If
theOptions = theOptions & " -loglevel error -stats"
'LET'S GET READY TO CONVERT
ConvertProcessInfo.FileName = theApp
ConvertProcessInfo.Arguments = theOptions
'LET'S TRY TO CAPTURE STATUS
ConvertProcessInfo.RedirectStandardError = True
ConvertProcessInfo.RedirectStandardOutput = True
ConvertProcessInfo.UseShellExecute = False
ConvertProcessInfo.CreateNoWindow = True
'LET'S PROVIDE SOME MEANINGFUL INFO
procFFMPEG.StartInfo = ConvertProcessInfo
lstStatus.Items(i) = "Encoding: " & theFormat
txtProcessInfo.Text = "Encoding file: " & theNewFilename & "." & theFormat
'LET'S DISABLE CONTROLS WHILE CONVERT IS WORKING AND ENABLE PROGRESSBAR
prgrssConvert.Visible = True
DisableControls()
'LET'S CONVERT
procFFMPEG.Start()
Do
Application.DoEvents()
ffStatus = procFFMPEG.StandardError 'Send standard error to ffStatus
strFFout = ffStatus.ReadLine 'Read every line of output and send to strFFout
Debug.Print(strFFout)
txtProcessInfo.Text = strFFout
'THESE LINES IS NOT NEEDED IF ASYNC WILL WORK
txtProcessInfo.Refresh()
lstSourceFiles.Refresh()
lstStatus.Refresh()
prgrssConvert.Refresh()
Loop Until procFFMPEG.HasExited
'LET'S WAIT FOR PROCESS TO EXIT
Await Task.Run(Sub() procFFMPEG.WaitForExit())
'UPDATE STATUS AFTER EVERY FILE
prgrssConvert.Visible = False
lstStatus.Items(i) = "DONE"
Next
End If
Next
'WHEN ALL FILES DONE, UPDATE STATUS
txtProcessInfo.Text = "Encoding completed. Waiting for new task"
EnableControls()
End If
End Sub
My problem is that the progressbar (prgrssConvert.Visible = True) is not updating asynchronously that is why I have to add refresh in the DO LOOP but it is not that visually appealing because it is "robotic" and not smoothly flowing marquee.
It looks to me that async is not doing it's job. I am hoping to keep the progressbar marquee running while waiting for the ffmpeg process to complete.
Any idea why async is not working on my code?
Thanks
There perfect answer for a good questions. I didn't see you were returning the output to a textbox. sorry. You have to use readlineasync otherwise your are waiting for a line from your output that might only come at the end. If it never comes your app will be stuck there.
This is for reading errors procFFMPEG.StandardError
If you actually want the output of your process use this
procMMFPEG.StandardOutput instead or both but you will need to adapt your code to it
some reference for StandardOutput
Public Async Sub GoConvert(theVCodec As String, theHeight As String)
Dim theOptions As String, theApp As String, theSourcePath As String, theDestPath As String
Dim theFilename As String, theACodec As String, theFormat As String, theLosslessOpt As String
Dim theNewFilename As String, theNewFileTag As String, theInterlaced As String, theMsg As String
Dim thePreset As String, theCRF As String
Dim ffStatus As StreamReader, strFFout As String
'On Error GoTo Handler
'SET DEFAULT VALUES
theApp = "ffmpeg.exe"
theSourcePath = txtSource.Text
theDestPath = txtOutput.Text & "\"
theACodec = "libmp3lame"
thePreset = "veryfast"
theCRF = "22"
theInterlaced = ""
theNewFileTag = ""
theLosslessOpt = ""
Select Case theVCodec
Case "libx264"
theNewFileTag = "x264"
Case "libxvid"
theNewFileTag = "xvid"
Case "libx265"
theNewFileTag = "x265"
End Select
If cmbUseCodec.Text = "x264 vegas" Then
theACodec = "aac"
theNewFileTag = "x264forVegas"
End If
theMsg = "IF FILE EXISTS, IT WILL BE OVERWRITTEN!" & vbCrLf & vbCrLf & "Please make sure that there is no filename conflict in the destination folder," & vbCrLf & "Encoder will overwrite existing files." _
& vbCrLf & vbCrLf & "Do you want to continue?"
If MessageBox.Show(theMsg, "WARNING!", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) = DialogResult.Yes Then
'LET'S DISABLE CONTROLS WHILE CONVERT IS WORKING AND ENABLE PROGRESSBAR
prgrssConvert.Visible = True
DisableControls()
prgrssConvert.value = 0 'I assumed this was a progressbar
prgrssConvert.maximum = lstSourceFiles.Items.Count * chkToFileType.CheckedItems.Count
For i As Integer = 0 To lstSourceFiles.Items.Count - 1
If chkToFileType.CheckedItems.Count <> 0 Then
Dim x As Integer
Dim forVegas As String
For x = 0 To chkToFileType.CheckedItems.Count - 1
theFormat = chkToFileType.CheckedItems(x).ToString
'GET FILENAMES ON FILES LISTBOX
theFilename = lstSourceFiles.Items(i).ToString
theNewFilename = System.IO.Path.GetFileNameWithoutExtension(theFilename)
If chkSameOutputFolder.CheckedItems.Count > 0 Then
theDestPath = Path.GetDirectoryName(theFilename) & "\"
End If
If (theVCodec = "libx265") Then
theCRF = "28"
thePreset = "medium"
End If
If (chkLossLess.CheckedItems.Count > 0) And (theVCodec = "libx265") Then
theLosslessOpt = "-x265-params lossless=1 "
End If
If theFormat = "mp3" Then
'-i "%%a" -qa 0 - map a "%%~na.mp3"
theOptions = " -i " & Chr(34) & theFilename & Chr(34) & " -y -q:a 0 -map a " & Chr(34) & theDestPath & theNewFilename & "." & theFormat & Chr(34)
Else
'PREPARE NEW FILENAME OF CONVERTED FILE
theNewFilename = theNewFilename & "-" & theNewFileTag & "-" & theHeight & "p"
theOptions = " -i " & Chr(34) & theFilename & Chr(34) & " -y -vcodec " & theVCodec
theOptions = theOptions & " -vf " & theInterlaced & "scale=" & Chr(34) & "trunc(oh*a/2)*2:" & theHeight & Chr(34)
If cmbUseCodec.Text = "x264 vegas" Then
forVegas = " -strict experimental -tune fastdecode -pix_fmt yuv420p -b:a 192k -ar 48000"
theOptions = theOptions & " -preset " & thePreset & " -crf " & theCRF & " -acodec " & theACodec & forVegas
theOptions = theOptions & " -threads 4 " & theLosslessOpt & Chr(34) & theDestPath & theNewFilename & "." & theFormat & Chr(34)
Else
theOptions = theOptions & " -b 1750k -preset " & thePreset & " -crf " & theCRF & " -acodec " & theACodec
theOptions = theOptions & " -ac 2 -ab 160k -threads 4 " & theLosslessOpt & Chr(34) & theDestPath & theNewFilename & "." & theFormat & Chr(34)
End If
End If
theOptions = theOptions & " -loglevel error -stats"
'LET'S GET READY TO CONVERT
ConvertProcessInfo.FileName = theApp
ConvertProcessInfo.Arguments = theOptions
'LET'S TRY TO CAPTURE STATUS
ConvertProcessInfo.RedirectStandardError = True
ConvertProcessInfo.RedirectStandardOutput = True
ConvertProcessInfo.UseShellExecute = False
ConvertProcessInfo.CreateNoWindow = True
'LET'S PROVIDE SOME MEANINGFUL INFO
procFFMPEG.StartInfo = ConvertProcessInfo
lstStatus.Items(i) = "Encoding: " & theFormat
txtProcessInfo.Text = "Encoding file: " & theNewFilename & "." & theFormat
'LET'S CONVERT
procFFMPEG.Start()
Do
ffStatus = procFFMPEG.StandardError 'Send standard error to ffStatus
strFFout = Await(ffStatus.ReadLineAsync()) 'Read every line of output and send to strFFout
Debug.Print(strFFout)
txtProcessInfo.Text = strFFout
Loop Until procFFMPEG.HasExited = True
'UPDATE STATUS AFTER EVERY FILE
prgrssConvert.value += 1
Next
lstStatus.Items(i) = "DONE"
End If
Next
prgrssConvert.Visible = False
'WHEN ALL FILES DONE, UPDATE STATUS
txtProcessInfo.Text = "Encoding completed. Waiting for new task"
EnableControls()
End If
End Sub
This is untested, but can you try this:
Do
Await Task.Delay(TimeSpan.FromSeconds(0.1))
ffStatus = procFFMPEG.StandardError 'Send standard error to ffStatus
strFFout = ffStatus.ReadLine 'Read every line of output and send to strFFout
Debug.Print(strFFout)
txtProcessInfo.Text = strFFout
Loop Until Await Task.Run(Function() procFFMPEG.HasExited)
Here's a simple bit of code to test that this works:
Dim process As New Process()
process.StartInfo = New ProcessStartInfo("C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe")
process.Start()
Do
Await Task.Delay(TimeSpan.FromSeconds(0.1))
Console.WriteLine("!")
Loop Until Await Task.Run(Function() process.HasExited)
It produces lines of ! until the PowerShell console is closed.

VBA how to check if download files from Server has success?

I'm able to use the below code to download files from server. However, this does tell me whether the files are downloaded successfully.
Sub DownloadFirstRunFilesPart2()
Application.StatusBar = "Downloading files..."
Dim wsh As Object
Dim errorcode4 As Integer
Dim cmd5 As Variant
Dim FirstRunFiles(5) As Variant
Dim var As Variant
FirstRunFiles(0) = ProN & "_KSParameter_UserInput.xlsx"
FirstRunFiles(1) = ProN & "_KSParameter_SysOutput.xlsx"
FirstRunFiles(2) = ProN & "_ModelParameter_UserInput.xlsx"
FirstRunFiles(3) = ProN & "_ModelParameter_SysOutput.xlsx"
FirstRunFiles(4) = ProN & "_VarClusParameter_UserInput.xlsx"
FirstRunFiles(5) = ProN & "_VarClusParameter_SysOutput.xlsx"
For Each var In FirstRunFiles
cmd5 = Chr(34) & "C:\Program Files (x86)" & "\PuTTY\pscp.exe" & Chr(34) & " -sftp -l " & pUser & " -pw " & pPass & _
" " & " " & pHost & ":" & ServerPath & "/" & var & " " & LocalPath & "\"
Set wsh = CreateObject("wscript.shell")
errorcode4 = wsh.Run(cmd5, vbHide)
'If errorcode4 = 0 Then MsgBox ("Error occurs. Fail to download " & var)
Next var
Application.StatusBar = "Download complete"
MsgBox ("Downloading process complete.")
End Sub
My error code always equals 0 no matter the file exists or not. How should I change this program?
Thanks in advance!
Update:
The new code that I tried:
Sub test()
Dim wsh As Object
Dim WshShellExec As Variant
Dim cmd3 As String
Dim pFirstRunFile1 As String
Const WshFinished = 1
Const WshFailed = 2
pFirstRunFile1 = "this_proj_name.txt"
cmd3 = Chr(34) & "C:\Program Files (x86)" & "\PuTTY\pscp.exe" & Chr(34) & " -sftp -l " & pUser & " -pw " & pPass & _
" " & " " & pHost & ":" & ServerPath & "/WOE/" & pFirstRunFile1 & " " & LocalPath & "\WOE"
Set wsh = CreateObject("wscript.shell")
WshShellExec = wsh.Exec(cmd3)
Select Case WshShellExec.Status
Case WshFinished
strOutput = WshShellExec.StdOut.ReadAll
Case WshFailed
strOutput = WshShellExec.StdErr.ReadAll
End Select
MsgBox strOutput 'write results in a message box
End Sub
However I'm getting error on this line:
WshShellExec = wsh.Exec(cmd3)
The error message says "Object does not support this property or method". Any ideas?

Variable from VBA to VBScript

I am working on VBA, from which I have to call a vbscript by passing some values.
Here is the code:
''VBA
'Below values are on different cells of Excel file which I am reading
'into a global variable then pass it to vbscript.
'SFilename = VBscript file path
'QClogin = "abc"
'QCpassword = "abc"
'sDomain = "xyz"
'sProject = "xyz123"
'testPathALM = "Subject\xyz - Use it!\xyz_abc"
'QCurl = "http://xxx_yyy_zzz/qcbin/"
Set wshShell = CreateObject("Wscript.Shell")
Set proc = wshShell.exec("wscript " & SFilename & " " & QClogin & _
" " & "" & QCpassword & " " & "" & sDomain & " " & "" & sProject & _
" " & "" & testPathALM & " " & "" & QCurl & "")
''VBscript on some location
Dim strUserName, strPassword, strServer
strUserName = WScript.Arguments(0) '"abc"
Msgbox "strUserName : " & strUserName
strPassword = WScript.Arguments(1) '"abc"
Msgbox "strPassword : " & strPassword
strServer = WScript.Arguments(5) '"http://xxx_yyy_zzz/qcbin/"
Msgbox "strServer : " & strServer
Dim strDomain, strProject, strRootNode
strDomain = WScript.Arguments(2) '"xyz"
Msgbox "strDomain: " & strDomain
strProject = WScript.Arguments(3) '"xyz123"
Msgbox "strProject: " & strProject
strRootNode = WScript.Arguments(4) '"Subject\xyz - Use it!\xyz_abc"
Msgbox "strRootNode: " & strRootNode
Now, when I running the code, it is passing below values properly to vbscript:
QClogin = "abc"
QCpassword = "abc"
sDomain = "xyz"
sProject = "xyz123"
It is having issues with these:
testPathALM = "Subject\xyz - Use it!\xyz_abc"
QCurl = "http://xxx_yyy_zzz/qcbin/"
Now, wierd thing for me is, if I keep a cell empty for "testPathALM" which is having "Subject\xyz - Use it!\xyz_abc" as value, I am getting "QCurl" value properly in vbscript.
But, if I keep value "Subject\xyz - Use it!\xyz_abc" for "testPathALM", then I am getting "-" for strServer which suppose to be "QCurl" value and "Subject\xyz" for "strRootNode" which supposed to be "Subject\xyz - Use it!\xyz_abc".
I am unable to understand what is the issue here.
Thanks a ton in advance.
Safer to quote all of your parameters:
Set wshShell = CreateObject("Wscript.Shell")
Set proc = wshShell.exec("wscript """ & SFilename & """ """ & _
QClogin & """ """ & QCpassword & """ """ & _
sDomain & """ """ & sProject & """ """ & _
testPathALM & """ """ & QCurl & """")
Try a debug.print to make sure it looks as it should...