Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi friends
Is that possible at all?
Look.
I'm trying:
1. Run QV app with the next script:
LET vtmpFile = 'C:\Users\ADMIN\Desktop\PowerShell Runs VBA Sub\RunVBASub.ps1';
EXECUTE powershell.exe /C /Q $(vtmpFile);
2. I wrote the Power Shell commandlets to run Excel's VBA macros:
Set-ExecutionPolicy Unrestricted
$excel = new-object -comobject excel.application
$strFileName = "C:\Users\ADMIN\Desktop\PowerShell Runs VBA Sub\TEST.xlsm"
$excelFiles = Get-ChildItem -Path($strFileName)
$app = $excel.Application
$workbook = $app.workbooks.open($excelfiles)
$app.Visible = $False
$excel.displayalerts = $False
$workbook.Activate()
$app.Run("CreateTXT")
$tmpFileName = "C:\Users\ADMIN\Desktop\PowerShell Runs VBA Sub\tmpTEST.xlsm"
$workbook.saveas($tmpFileName)
$workbook.close()
$excel.quit()
If (Test-Path $strFileName){
Remove-Item $strFileName
}
Rename-Item $tmpFileName $strFileName
3. VBA macros saving text file into folder:
Sub CreateTXT()
strFile_Path = "C:\Users\ADMIN\Desktop\PowerShell Runs VBA Sub\Check.txt"
Open strFile_Path For Output As #1
Print #1, "CheckMask"
Close #1
End Sub
Question:
How give to qv administrator right's to run powershell commandlets. Because if i'm running powershell script as administrator - everything works fine. But when i trying run the power shell script from qv using "EXECUTE" statement - it is not works. Please Help me to do that.
Thanks in advance.
P.S: All sources in attachment
https://community.qlik.com/thread/196972
See my reply
Vikas