Hello World Macro

The simplest macro in Visual Basic for Applications (VBA) in Microsoft Excel is as per the code below:

Option Explicit

Sub Hello_World()
'---------------------------------------------------------------------------------------
' Procedure : Hello_World
' Author    : vsmathur-onms
' Date      : 17/10/2019
' Purpose   :
'---------------------------------------------------------------------------------------
'

   On Error GoTo Hello_World_Error

    MsgBox "Hello World !!", vbOKOnly

Hello_World_Exit:

    On Error GoTo 0
    Exit Sub

Hello_World_Error:

    MsgBox "Error " & Err.Number & " on Line # " & Erl & " (" & Err.Description & ") in procedure Hello_World of Module m_HelloWorld"
    Resume Hello_World_Exit

    
End Sub
Hello World Macro Step 1
Step 1 – Create Shape or WordArt on Worksheet
Hello World Macro Step 2
Step 2 – Clicking the WordArt Image executes the macro.

Published by Vikram Shankar Mathur (vsmathurvivaldi)

I am a chartered accountant from Ahmedabad, Gujarat, India. You should contact me at vsmathur(at)vivaldi(dot)net !! Cheers !!

%d bloggers like this: