Auto Indent VBA Code/Office Programming Helper free download

Auto Indent VBA Code/Office Programming Helper free download

Office Programming Helper/Auto Indent VBA Code allows the formatting of macros, adding line numbers, error handlers, and more. freeware free download

System Requirements for Office Programming Helper/Auto Indent VBA Code/Indent VB

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

What’s New in Office Programming Helper/Auto Indent VBA Code/Indent VB

  • Minimize some system requirement

Is it for you? Office Programming Helper/Auto Indent VBA Code/Indent VB

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

  • Microsoft Word, Excel, and PowerPoint macros writers
  • MS Access form design
  • 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

Background of Office Programming Helper/Auto Indent VBA Code/Indent VB

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

How to use this application to indent your VBA Code and add an 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 the Add-Ins menu, choose to add an 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
EorrorHandler:
    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

  • 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 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 the computer clipboard. Example: put or get a text from the clipboard with a specific format, clear the clipboard, or convert the text format to Unicode.
  • You could put or get the text with the following formats: Text, Unicode text, RTF, HTML.
    Sub Test()
        NP.Clipboard.Clear
        NP.Clipboard.SetText "Some Text"
        NP.Clipboard.Ascii2Unicode
        NP.Clipboard.Unicode2Ascii
        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
Debug.Print(c.ConvertToWords(10002015))

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 the 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 ActiveX containers.

Related Articles

Molar Mass Calculator ~ Molecular Weight

Links

Keywords

VBA auto-indent shortcut, VBA code formatter online, VBA code cleaner,  VBA smart indenter, excel auto-indent, indent your code for readability, excel VBA to auto-indent code, VBA code indentation, indenting VBA code automatically, VBA code automatically indenting
code re automatically indenting VBA, automatically indenting VBA code, excel VBA indentation,
How do I indent the VBA code? How do I beautify VBA code? Does VBA care about indentation?

Comments. discussion and feedback

This article on Codeproject

totop