The news is by your side.

Office Programming Helper Indent VB Code


Using the product: free

Updates for 1 year and email customer support: 5$

System Requirements

  • Windows XP, Vista, 7, 8, 8.1, 10 (32Bit or 64Bit)
  • .NET Framework version 4 or later
  • Any version of Microsoft Office 2007, 2010, 2013, 2016, 2019, 365 (32Bit Or 64Bit)or any single office application such as Word or Excel.

What’s New

  • Minimize some system requirement

For Whom This Application is Written

If you are one or more of the following, then I hope that you will find this application helpful:

  • Microsoft Word, Excel and Power Point macros writers
  • MS Access forms designer
  • VBA (Visual Basic for application) Developers
  • Add in builder

How This Application Differs

  • This application is not just an add-in. It offers many other helpful resources.
  • It provides to you the simplest way to build your add-on


Although VB6 went out, VBA is still needed to develop Office macros or Microsoft Access modules so VBA add-in is important.

Using this application to indent your VBA Code and add error handler:

  • Install the app
  • Open an Office document that contains macro and edit the macro in VBA Window it or open Microsoft Access Module.
  • Write your VBA code.
  • From Add-Ins menu, choose Add error handler to this file
  • This will change the format of your code as follows…

Sample of code before applying this add in:

Public Sub Macro1()
    MsgBox("This is Macro1")
End Sub

Sample of code after applying this add in:

Public Sub Macro1()
    On Error GoTo EorrorHandler
1   MsgBox("This is Macro1")
    Exit Sub
    Debug.Print "Error in: Module1.Macro1." & Erl & vbNewLine & Err.Description
    'This will print the error Module name and the Error Sub Name and 
    'line number in the immediate window and this is useful in debugging
    Debug.Assert False
    'This will stop the execution of the code if you are in debug mode and 
    'has no effect in run mode
    MsgBox "Error in: Module1.Macro1." & Erl & vbNewLine & Err.Description
    'This will show a message box about the error in run time
End Sub

Using this application to expose Some .NET to your VBA code

Declaring NP and Number to words Objects

  • Open an Office document that contains macro and edit the macro in VBA Window it or open Microsoft Access Module
  • In VBE Window Select Tools, References, Browse, then select the file
    C:\Program Files\OfficeProgrammingHelper\Bin\OfficeProgrammingHelper.tlb
  • Repeat this for the file
    C:\Program Files\OfficeProgrammingHelper\Bin\NumberToText.tlb
  • Insert the following code in a any VBA Module:
    Public NP As New OfficeProgrammingHelper.NP
  • Now you could use the NP object in any code in your project.

Using NP Object

You could call the NP object in your code to use the functions

  • NP.Clipboard It is used to access computer clipboard. Example: put or get text from the clipboard with specific format, clear the clipboard or converting the text in it form or to Unicode.
  • You could put or get text with the following formats: Text, Unicode text, RTF, HTML.
    Sub Test()
        NP.Clipboard.SetText "Some Text"
        Debug.Print NP.Clipboard.GetText
    End Sub
  • NP.Directory: Create, Delete, Exists, Move
    Sub Test()
        If Not NP.Directory.Exists("C:\Temp") Then NP.Directory.CreateDirectory "C:\Temp"
        NP.Directory.Move "C:\Temp", "C:\Temp2"
        NP.Directory.Delete "C:\Temp2"
    End Sub
  • NP.File: Copy, Create, Delete, Exists, Move, Shell
    Sub Test()
        If Not NP.File.Exists("C:\Temp.txt") Then NP.File.Create "C:\Temp.txt"
        NP.File.Move "C:\Temp.txt", "C:\Temp2.txt"
        NP.File.Copy "C:\Temp2.txt", "C:\Temp.txt"
        NP.File.Delete "C:\Temp2.txt"
        NP.Shell "C:\Temp.txt"
    End Sub
  • NP.Screen: CM, Height, Width, TwipsPerPixelX, TwipsPerPixelY
  • NP.Text: EncodingConvert, EncodingConvertByCodePage, GetTextHeight, Md5Hash, TrimAny
  • NP.SQL

Numbers to Words Text

This library will convert numbers to words in English or Arabic and could be used in your Office applications:

Dim c As New NumberToArabicWords

Switch Off the Debug Mode When Executing Office Macro

  • Open an Office document that contains macro and edit the macro in VBA Window it or open Microsoft Access Module
  • From Tools menu, choose your project properties, then choose Protection
  • Check the Lock project for viewing
  • Type a password and click OK
  • Close your document and reopen it

Useful Ready to Import VBA Code

You will find in the bin directory of the application some useful VBA code ready to use:

  • Molecular Weight Calculation code that enables calculating Molecular Weight from the line formula
  • Useful MS Access database function to help in refresh linked tables and to get the next empty integer value for the field in a query and to get LastValue in a table

Expose .NET Controls as ActiveX

This library also provides exposing some .NET controls to be used in Office VBA forms and in ActiveX containers.

Related Articles

Molar Mass Calculator ~ Molecular Weight