Jump to content

Calling Notepad from Excel VBA using AutoITX3 Type Library


Recommended Posts

I am a new comer to AutoITX3. I will be  using the AutoIT from within Excel VBA. I added AutoItX 1.0 Type library to my VBA using Tools - Refernces command. I am trying to write  to Notepad from within Excell.  I am using Notepad as a first step before using richer applications. I identified the Window Info for Notepad using AutoIT v3 Window Info tool.

(I tried to post the Window info as a screen shot as bmp and jpeg in this post.  I got a warning message  "You are not allowed to use that image extension on this community.")

Sub TestNotepad()
    Dim autoit As AutoItX3
    Set autoit = New AutoItX3

    autoit.Run "notepad.exe"
    autoit.Sleep (100)         ' Wait for note to finish loading
    autoit.ControlSend "Untitled - Notepad", "", "[CLASSNN:Edit1]", "This is a test"

End Sub

However, the notepad does not open up.with a message. Also, I am not able to see Immediate window. I have tried Windows 7 (64 bit machine -- but used AutoIt  3 regular version in compatibility mode (not 64 bit mode) and not beta version) with Excel 2007. Also, no luck with Windows XP with Excel 2003 as well. 

Any ideas as to how fix the problem would be appreciated.

Thanks.

Ram

Link to comment
Share on other sites

 

"You are not allowed to use that image extension on this community.")

I suspect you need to have at least 10 posts to upload files to the forum.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Have you tried to put all the AutoIt processing into a single compiled script and start it from VBA?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...