NickTriman Posted January 31, 2019 Posted January 31, 2019 Hi there, I'm a newbie with autoit and I have a question : I learned alone with the help section how to read in excel's cells or range with autoit and it works fine. BUT how could I read data on Textboxes in Userform in Excel ? What I would like to achieve is to save the Excel's USF Textboxes value / content in a variable on autoit to reuse it after (on Microsoft Dynamic NAV). Can somebody help me or show me where to find the answer ? (Sorry for my English, I'm French) Thank you in advance
Nine Posted January 31, 2019 Posted January 31, 2019 Salutations @NickTriman Userform is an object and you can manipulate it as is. You can read about it in msdn : https://docs.microsoft.com/en-us/office/vba/language/reference/user-interface-help/userform-object If you need help, upload an example of the excel userform you wish to interact with and we can work from there... “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
NickTriman Posted February 1, 2019 Author Posted February 1, 2019 @Nine Hello Nine and thank you for your reply I tried to use something like $vartest = GUICtrlRead($TextBox1) But I have an error message because $TexBox1 is not declared ... Please fond attached an Excel file with an example of what I'm trying to do ... If you can write me a script for that with a quick explanation it would be perfect . Test Excel Example.xlsm
Nine Posted February 1, 2019 Posted February 1, 2019 Can't read your example. I am still at 2003, and it doesn't want to convert. Have you read the userform doc that I suggested to you ? Try some and post your code. “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
NickTriman Posted February 1, 2019 Author Posted February 1, 2019 @Nine I read it but didn't understand a thing ... I'm good in VBA code but autoit I'm a real newbie. Here is another version of my file example compatible with 2003. Hope it will work this time. Test Excel Example.xls
NickTriman Posted February 1, 2019 Author Posted February 1, 2019 @Nine Just so you know, my excel file homemade CRM for my company and it works like a charm. It's in full excel VBA language. I only want to use Autoit to automatically copy and paste some Textboxes content to another software. All I'm asking for is an exemple of how to do that. So far I wrote an Autoit program with an association of multiples TAB and CTRL+C , CTRL+V etc to achieve it but It takes like forever because the script is going back and forth between excel and the other programs (plus it's buggy). So I want to launch an Autoit program from the Excel Userform (in VBA by clicking a button) and put each textbox content in a single variable in Autotit program. Then I will do the other way around to copy each variable from Autoit to the correspondant textboxes in the other program. I hope a made myself a little bit clearer this time. Thank you for your help
Nine Posted February 1, 2019 Posted February 1, 2019 Here to start you up (it is not the most elegant way but it does the work) : #include <Excel.au3> Opt ("MustDeclareVars", 1) Local $oExcel = _Excel_Open(Default, False, Default, Default, True) If @error Then Exit MsgBox($MB_SYSTEMMODAL, "", "Error creating a new Excel application object." & @CRLF & "@error = " & @error & ", @extended = " & @extended) Local $sWorkbook = @ScriptDir & "\Test Excel Example.xls" Local $oWorkbook = _Excel_BookOpen($oExcel, $sWorkbook) If @error Then Exit MsgBox($MB_SYSTEMMODAL, "", "Error opening '" & $sWorkbook & "'." & @CRLF & "@error = " & @error & ", @extended = " & @extended) Sleep (500) MouseClick ("left", 265, 315, 1, 1) Sleep (500) Send ("{TAB}{TAB}^c") Local $Var1 = Clipget () Send ("{TAB}^c") Local $Var2 = Clipget () Send ("{TAB}{SPACE}") _Excel_Close ($oExcel, False, True) MsgBox (0,"","First Field is " & $Var1 & @CRLF & "Second Field is " & $Var2) “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
NickTriman Posted February 1, 2019 Author Posted February 1, 2019 @Nine Thank you for your code but in fact it is what I already do with my current code. What I'm trying to do is improve it and do something like : $var1=$Textbox1 $var2=$Textbox2 kinda like without using the TAB , ctrl+C , ctrl+V etc I hope I'm making myself clear ...
Nine Posted February 1, 2019 Posted February 1, 2019 (edited) 34 minutes ago, NickTriman said: Thank you for your code but in fact it is what I already do with my current code. Well, you should have post your code first, so I wouldn't have lost my time on it. I hope I'm making myself clear ... Edited February 1, 2019 by Nine “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
NickTriman Posted February 1, 2019 Author Posted February 1, 2019 The title of my demand is "Read from Excel Userform Textboxes" Your solution is a workaround but not what I'm searching for as I already did that way By the way I wrote right before your proposal : "So far I wrote an Autoit program with an association of multiples TAB and CTRL+C , CTRL+V etc to achieve it but It takes like forever because the script is going back and forth between excel and the other programs (plus it's buggy). " Anyway if you don't know how to do it , no problem or don't want to help further, no problem. Thank you for your time.
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