AutoHotkey and Excel Object model: Application, Workbook, Worksheet

While using AutoHotkey to connect to Excel is “easy”, it is also easy to be trying to use call a function to the wrong Excel object.  In this video we discuss the below diagram and explain how to use AutoHotkey and Excel Object model.

autohotkey-and-excel-object-model

Here is the function for specifying which Excel object you want to connect to

Video walking through AutoHotkey and Excel Object model

AutoHotkey and Excel Objects-Application, Workbook, Worksheet

Generate Outlook Address book from all emails in Outlook

Generate Outlook address bookWouldn’t it be nice if you could generate Outlook address book from your email traffic?

This video demonstrates a script I wrote that allows to select which Outlook folders you want to iterates over and then loops over them storing key info like: name, last received email date from, # of emails, Size of attachments, etc.  The script even keeps track of emails you’ve already iterated over so you can run it multiple times yet it only counts the email once.

Generate Outlook address book

Create an Outlook email-addressbook based on email frequency

Create / Connect to Excel with AutoHotkey via COM

excel-with-autohotkey

Automating Excel with AutoHotkey is pretty easy however first connecting with the Excel object can be a bit confusing.

This video walks through both connecting with a running Excel application and creating a new one.  It also walks you through how to set the object visible (and use the Task Manager to see if it exists)

Here is the code reviewed in the video:

Creating & Connecting to Excel with AutoHotkey via COM

Creating & Connecting to Excel with AutoHotkey

AutoHotkey Webinar: 9/20/2016

AutoHotkey webinarAutoHotkey Webinar Videos and Links

Link to AutoHotkey Webinar resources:

Additional resources mentioned in AutoHotkey Webinar

Using built-in Functions

SubStr(String, StartingPos [, Length])

Trim()

Round(Number[,N])

Creating your own custom function

  • Why you want to create them
  • Things to pay attention to:
    • Accessing variables outside your function
    • Passing parameters
    • Setting defaults
    • Returning values

DLL call

  • What is it?
  • Why is it so valuable an Asset?
  • Why is it so ‘tricky’?
  • Message Box

 

Additional DLLCall Resources

Script Highlight- Pasting plain text