themaccabee Posted April 23, 2017 Share Posted April 23, 2017 Hi Im trying to run autoitscript from excel vba using a button click. I wanted to run notepad1.au3 script from an excel sheet. i copied the script into the same directory as excel sheet. I wrote the following vba code to run the script.Everything seems to work fine, it takes the path file name etc accurately. But instead of just running the script, an explorer window pops up ,asking me to locate the script i want to run. I can browse to the location of the script through the explorer window and select the script file and it will run. But i want it to run without opening an explorer window. Any idea where could be the problem? Thanks VBA Code: Sub Autoit() Dim AutoItPath Dim FileName As String Dim FileName1 As String FileName = ThisWorkbook.Path & "\notepad1.au3" MsgBox (FileName) AutoItPath = "C:\Program Files (x86)\AutoIt3" & "\AutoIt3.exe " MsgBox (AutoItPath) FileName1 = """" & AutoItPath & """" & "notepad1.au3" MsgBox (FileName1) runscript = Shell(FileName1) End Sub Link to comment Share on other sites More sharing options...
themaccabee Posted April 23, 2017 Author Share Posted April 23, 2017 Sorry please refer the below code, above one had a mistake Sub Autoit() Dim AutoItPath Dim FileName As String Dim FileName1 As String FileName = ThisWorkbook.Path & "\notepad1.au3" MsgBox (FileName) AutoItPath = "C:\Program Files (x86)\AutoIt3" & "\AutoIt3.exe " MsgBox (AutoItPath) FileName1 = """" & AutoItPath & """" & """" & FileName & """" MsgBox (FileName1) runscript = Shell(FileName1) End Sub Link to comment Share on other sites More sharing options...
spudw2k Posted April 24, 2017 Share Posted April 24, 2017 (edited) I notice there is no space between the quote wrapped paths. What happens if you add a space between the exe and au3 paths and remove the extra space from the end of the AutoIt path? Also, breaking out the exe from the program files dir seems erroneous to me, unless I am missing something... AutoItPath = "C:\Program Files (x86)\AutoIt3\AutoIt3.exe" FileName1 = """" & AutoItPath & """" & " " & """" & FileName & """" Edited April 24, 2017 by spudw2k Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX Builder Misc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retrieve SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose Array Projects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalc Cool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now