This site uses different types of cookies, including analytics and functional cookies (its own and from other sites). To change your cookie settings or find out more, click here. If you continue browsing our website, you accept these cookies.
I'm playing around with a VBA front end in Excel and running Shell, command line code to kickoff some workflows on my desktop (no Alteryx Server yet sadly). I'm beginner level on using command line statements and syntax so I was wondering if there is a command line option to export the messages log? If so, what's the proper syntax for it. Also is there any sort of command line reference out there for Alteryx providing any and/or all functions, commands, syntax etc.?
Just to show my simple code:
Dim path As String
Dim engine As String
Dim wsh As Object
Dim outp As Object
Dim waitReturn As Boolean: waitReturn = True
Dim cmdWnd As Integer: cmdWnd = 1
Dim result As Long
'Dim logPath As String
'Set wsh to WScript.Shell object
Set wsh = VBA.CreateObject("WScript.Shell")
'Set your workflow path from "A2" and encapsulate in double quotes
path = """" & Sheet1.Range("A2").Value & """"
'Set location of Alteryx Engine unless Alteryx Engine is set as environment variable on machine
engine = """C:\Program Files\Alteryx\bin\AlteryxEngineCmd.exe"""
'Set logPath -- Not working at the moment
'logPath = """" & Environ("UserProfile") & "\Desktop\LogFile.txt"""
'Run the command line, keeping the window open in normal view and do wait for engine to finish before continuing
result = wsh.Run(engine & " " & path, cmdWnd, waitReturn)
'Load output from cmd to log not working at the moment
'Set outp = wsh.stdout
If result = 0 Then
ElseIf result = 1 Then
MsgBox "Success but warnings"
ElseIf result = 2 Then
MsgBox "There was an error"
Ideally I'd like to export a log to see why it failed or had warnings if possible.
HI @JoeS thank you for the info. Unfortunately, I still get an error when using both the > or >>. I tried the logic you provided and also based on variable set e.g. Dim LogPath as string = "C:\..\Logfile.txt" it's just not letting me save out.
I'll keep digging around but I may need to set up the workflow as an Analytics App instead.
Sorry for the long delay. Interestingly enough I can run it perfectly within DOS but for some reason it errors when running it through VBA. It could be something with quote placement in the string and how the shell object is recognizing it. I’ll keep digging around and post back any findings. Much appreciated, huge help.