InvoicingTemplate.com main content

Screenshots and Images

The printed version.

Advanced Sample - Email Is Required Before Saving Invoice

Open the template in Excel.

Advanced Sample - Email Is Required Before Saving Invoice (IMFE Edition)

Download

License: Private Use (not for distribution or resale). See our Terms of Use.

You are safe to download the resources. We've added our digital signatures to the files.

DescriptionSizeDownload

Download this if you have already installed the Microsoft Store edition of Invoice Manager for Excel, and are looking for additional customized templates.

1705 KBDownload

Download this if you want this design to be set as the default template by the installer program.

6.35 MBDownload

Detail

Starting with version 7.11, Invoice Manager for Excel exposes all its major features via the COM add-in objects. This enables VBA macros to call the Invoice Manager functionalities, making our invoicing program programmable with VBA scripting language.

Note: This sample requires the "Enterprise" edition of Invoice Manager. For more information see Differences between Editions.

In Advanced Invoicing Sample - Macro-Enabled Invoicing Template (c5101) we looked at how to make your invoice template a macro-enabled template, and provided information and resource links involved, such as Office / Excel security settings, digital signature, etc. In Advanced Invoicing Sample - Invoiced Total in English Words (c5102), we provided a practical example implemented as a macro-enabled invoicing template, i.e. a user-defined Excel formula / function that is able to convert a numeric value into English words.

Unlike the billing format samples implemented in the "Simple Invoice Templates" series, where the customized templates are usually created by moving fields and cells, or modifying Excel formulas etc., this "Advanced Invoicing Sample" series contains samples that require some knowledge of VBA programming and Microsoft Excel / Office object model.

To call the procedures inside the Invoice Manager program, you first need to obtain the COM add-in object. This could be done using VBA code like this:

Public Sub CallImfe(ByVal sCmd As String)
    On Error Resume Next
    Dim oComAddin As Office.COMAddIn
    Set oComAddin = Application.COMAddIns("Imfe.Connect")
    If oComAddin Is Nothing Then
        MsgBox "Invoice Manager for Excel is not installed!", vbOKOnly
        Return
    End If
    oComAddin.Object.UisClickProc (sCmd)
End Sub

This CallImfe procedure takes one argument, i.e. the command that you want to call -- this is the button name that you want to call. For example, if you want to call the "Save To DB" command, you simply pass in the button name "oknCmdSave".

The CallImfe procedure obtains the Invoice Manager COM add-in by looking into the "Application. COMAddIns" collection. If it cannot find the "Imfe.Connect" (This is the Prog ID of Invoice Manager), it shows an error message " Invoice Manager for Excel is not installed!" and return. Otherwise, it pass the command to the add-in object.

The commands are always executed against the active workbook and active worksheet. Since different worksheets could have buttons with the same name, your VBA macro code should make sure the right workbook / worksheet is activated before issuing a command. For example, the "Invoice", "Quote" and "Purchase Order" worksheets in the default template shipped with Invoice Manager installer program all have the button named "oknCmdSave".

Once you have the CallImfe procedure ready, it is easy to call it. In this sample, we add macro code to check if the email field in the "Bill To" section is blank - if so, saving invoice will be failed and a message is shown to ask the user to enter the email address. (Feel free to see samples in the email invoice gallery).

  1. First open your invoice template as usual.
  2. Press ALT+F11 on keyboard to open the macro editor (Visual Basic for Applications editor).
  3. Create a new module by clicking the menu "Insert", and then "Module".
  4. Copy & paste the following code into the editor.
    Public Sub NewSaveToDBProc()
     
        If Range("oknWhoEmail").Value = "" Then
            MsgBox "Please enter email address in the 'Bill To' section.", vbExclamation + vbOKOnly, "Save Invoice"
            Exit Sub
        End If
        
        CallImfe ("oknCmdSave")
     
    End Sub
    
  5. Click menu "File" and then "Save".
  6. Click menu "File" and then "Close and Return to Microsoft Excel".
  7. Click the "Design Mode" button on the "Invoice" worksheet.
  8. Right-click the "Save To DB" button, choose "Assign Macro..." from the shortcut menu.
  9. On the "Assign Macro" dialog box, click and choose "NewSaveToDBProc" (which is the procedure name we created in the previous steps).
  10. Click "OK" to assign this new macro to the button and close the "Assign Macro" dialog box.
  11. Rename the button from the original "oknCmdSave" to something else, for example "MyNewSaveToDB". To do this, make sure the button is select, and then enter the new name into the name box on the formula bar.
  12. Exit design mode by clicking the "Design Mode" button again on the "Invoice" worksheet.
  13. Save the template by clicking the "Save" button on Excel quick access toolbar.

Now when you click the "Save To DB" button to save an invoice, your own macro code will check if the email address field is empty. If so, it will refuses to save the invoice; otherwise, the invoice will be saved normally.

You can provide any button name as the argument provided to "CallImfe" procedure. To find out the name of a button, first switch your template into design mode, and then click the button, the name box on the left-side of the formula shows the button name.

Format and Specification

Template#c5103
NameAdvanced Sample - Email Is Required Before Saving Invoice
CategorySales Invoice Template
Release DateTuesday, November 22, 2016
Format (XLS or XLSX).xlsm
Feature Gallery
Columns5
Lines12
Line Height (Points)18.00
Print Area$D$3:$K$46
Papaer Size / OrientationPortrait
Default Margins (Points)
Left18.00
Right18.00
Top75.60
Bottom75.60
PriceFree (0.00 USD)
SystemWindows 7 and later, and Excel 2007 and later.

Update History

October 1, 2018

  • Updated the document and code for Invoice Manager v7.11.

Samples

Screenshot for Advanced Sample - Invoiced Total in English Words

Advanced Sample - Invoiced Total in English Words

Screenshot for Advanced Sample - Macro-Enabled Invoicing Template

Advanced Sample - Macro-Enabled

Screenshot for Advanced Sample - Print One Invoice in Two Different Formats

Advanced Sample - Print One Invoice in Two Different Formats

Screenshot for Print Shop Bill Sample

Print Shop

Screenshot for Simple Template with Printable Watermark

Simple Template with Printable Watermark

Screenshot for Tax Invoice for Printing Shop

Printing Shop

Screenshot for Invoice and Packing List on Separate Worksheet

Invoice and Packing List on Separate Worksheet

Screenshot for Pet Sitting Invoice Sample

Pet Sitting

Screenshot for One Column Consulting Invoice Sample

One Column Consulting Invoice Sample

Screenshot for Construction Proposal Template

Construction Proposal

Screenshot for Construction Invoice Template

Construction Business

Screenshot for Job Estimate Template for Excel

Job Estimate Template for Excel