Link to home
Start Free TrialLog in
Avatar of Razvan Melinte
Razvan Melinte

asked on

how to add a message box that can grab the powershell result and prompt it in excel

Hello

I am using a vba code to run a command from excel to Powershell but i need to have a message box with the result of the powershell command.  
Below you can find the script that I am using.

Can you please help me ?


  file = "c:\users\User\desktop\SetMSXUser.ps1"
 Set cell = ActiveSheet.Range("Y12")


  Set ofile = CreateObject("Scripting.FileSystemObject").CreateTextFile(file)
  While cell.Value <> ""
    ofile.WriteLine cell.Value
    Set cell = cell.Offset(1)
  Wend
  ofile.Close
  Shell "powershell.exe  -file " & file
 

End Sub


Regards
Avatar of Neil Fleming
Neil Fleming
Flag of United Kingdom of Great Britain and Northern Ireland image

what do you want the messagebox to say?
Avatar of Razvan Melinte
Razvan Melinte

ASKER

the information provided by powershell.

if there is any error message, to provide the error message for example.
SOLUTION
Avatar of Qlemo
Qlemo
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial