

The screen object represents the host application screen and it provides methods and properties used to access host screen data. The GetText method used in the IBM sample is used to get the text from a screen location. The Open Systems library also has a GetText method that you can use in the same way. Now lets see where the Macro is in Excel 2010/2013. You can use this property to get the screen object for any macro in a session project. InfoConnect provides several other properties that you can use to get key objects when you are creating macros in session projects. For more about these properties, see Using the InfoConnect Object Model.
Excel macro code#
This opens the Visual Basic Editor to show you the code that. Macros automate common and repetitive keystrokes that you use in Excel to create and edit. Create an Excel Macro using a Command Button Create a Command Button Now that you have enabled the developer tab and have some familiarity with the VBA editor, let’s start creating a macro by using a command button. Select the AddTotal macro and click the Edit button. When opening a macro-enabled workbook, users are typically prompted if theyd like to enable macros. This macro uses an InfoConnect property (ThisScreen for Open Systems or ThisIbmScreen for IBM) to get the screen object for the session. But if you arent using macros yet, you dont know the half of it. Excels security features will disable macros by default. (If your screen doesn't have any text in the upper left part of the display area, you may need to change the row and column arguments and run the macro again to display some text.) The message box should display the text on the first line. Place the cursor anywhere in the procedure (Sub) you just created and then press F5.

Macros work in a very similar way to worksheet. ScreenText = ThisScreen.GetText2(1, 1, 30, 30) You can write an Excel macro in python to do whatever you would previously have used VBA for. Dim screenText As String 'Get text from the screen starting at screeen column 1, row 1
