Integra for Notes Banner
  QuickReports Integra4Notes Integra Family of Products



How to Run a Word or Excel Macro from Integra for Notes


When Integra for Notes exports data to a Microsoft Word document or Excel spreadsheet, you may wish to run a Word or Excel macro to automatically process the data, group, sort, filter etc. This can be undertaken either by creating an Automatic Macro in Word or Excel, such as the Auto_Activate macro, or by calling the Excel or Word macro from the Integra profile. Integra provides two methods of including the execution of a Word or Excel macro.

Advanced options

In the Advanced tab of the Integra profile it is possible to use the Excel/Word macro options, which allow the configuration of specific macros that are to be executed either after each exported document or after all documents have been exported.

The availability depends on the method of export. If Normal or XML is chosen then only only the run macro after all documents are exported option is available. Using the advanced COM method both macro execution options are available.

Using advanced script

This method would be achieved by placing a Lotuscript command within the Advanced tab of the Integra profile. The code below identifies an example which will automate the running of a macro called SortData by calling the stats.Xlsappl.Run method from within the BFORCOMACTION Integra event.

The following sample code requires the use of the Advanced COM export method!

Const CB_INITIALISE = 3
Const CB_BFORREADNOTES = 6
Const CB_BFORWRITECOM = 1
Const CB_BFORCOMACTION = 5
Const CB_BFORNOTESACTION = 2
Const CB_TERMINATE = 4

select case stats.cbstatus
case CB_INITIALISE
case CB_BFORREADNOTES
case CB_BFORWRITECOM
    ' WORD - format last paragraph after each exported Notes document
    ' call stats.WordAppl.Run("FormatParagraph")

case CB_BFORCOMACTION
    ' EXCEL - sort data after the export is complete
    ' call stats.XlsAppl.Run("SortData")
case CB_BFORNOTESACTION
    if not stats.savdoc is nothing then
      ' before save as...
    else
      ' before send to
    end if
case CB_TERMINATE
end select

.




FAQ# 0064
Bookmark and Share

 
QUICK LINKS
 
 

 

  © Shireburn Software Ltd. 2008 - 2024