Excel Macros with ElectroNeek

A macro must be written in a .vbs file with all corresponding macro creation rules. The ‘Execute macro’ activity can then be used to run the macro.

The main difficulty for users when working with macros is that variables and methods differ between .vbs and .vba formats. It is not possible to copy and execute a .vba script in Studio Pro. Even if the .vba format looks much easier than the .vbs format in use, the functionality of .vbs is similar to the .vba script.

When working with macros in MS Excel, there are several approaches, for example, the built-in Excel functionality involves creating macros, in which case they will be saved in .xlsm format. On the other hand, you can create macros separately from Excel using VBScript. Such files will have the format .vbs. Studio Pro supports such macros.

More information is available in the ElectroNeek Help Center:

How to execute .vbs-macro in the selected Excel file?

1 Like

I am trying to use the Execute Macro function and am a bit confused: the option only works when I have a separate macro file (extensions vbs or vba)? So, if I only have the embedded macro code in a .XLSM file, Can’t use the “execute macro” function?

1 Like

I suggest you use Chat GPT to build your Macro, in my case I just search my code, after I adapt the code, for exemple:

Sub TestMacros()
Dim xlApp, EmailBook
Set xlApp = CreateObject(“Excel.Application”)
Set EmailBook = xlApp.Workbooks.Open(WScript.Arguments(0))

<---------This part you should adapt ---------------------->
EmailBook.Sheets(“Test”).Range(“L:L”).NumberFormat = “0000000000”
EmailBook.Sheets(“Test”).Range(“R:R”).NumberFormat = “m/d/yyyy”
EmailBook.Sheets(“Test”).Range(“S:S”).NumberFormat = “m/d/yyyy”
EmailBook.Sheets(“Test”).Range(“O:O”).NumberFormat = “0”
<---------This part you should adapt ---------------------->

EmailBook.Save
EmailBook.Close True
xlApp.Quit
End Sub

Thank you, Pedro. Azevedo. I thought that the Excel Macro function of Electroneek does support VBA code, which is more powerful and allows for handling errors.