Integra for Notes Banner
  QuickReports Integra4Notes Integra Family of Products



How to export Excel spreadsheets to the file system with a random file name per Excel spreadsheet

It is possible with Integra for Notes to save Excel spreadsheets created with Integra back into documents of a Notes database as attachments. The scope of this FAQ is to show how these spreadsheets can be saved into a particular directory on the file system, giving each file a unique (sequential) file name.

The following code example placed into the Script Callback field of your Integra Excel profiles will do the trick. Please read the comments in between the code lines as they provide further information where you have to customise the code to your needs.

NOTE: You need to use the Excel Action 'Save to File' for the code to work. Also it is important to not use a file name prefix containing the word 'Integra', otherwise Integra will prompt the user to select a file name at runtime.

Const CB_INITIALISE = 3
Const CB_BFORREADNOTES = 6
Const CB_BFORREADCOM = 7
Const CB_BFORWRITECOM = 1
Const CB_BFORWRITENOTES = 8
Const CB_BFORCOMACTION = 5
Const CB_BFORNOTESACTION = 2
Const CB_TERMINATE = 4

select case stats.cbstatus
case CB_INITIALISE

   Dim path as string
   Dim fPrefx as string
   Dim fExt as string
   Dim forceRand as integer
   Dim ovrWrite as integer

   'this determines the path to store the Excel spreadsheet to
   path = "C:\" 

   'filename prefix can be configured accordingly
   fPrefx = "testing_"  

   'specifies file extension, in this case keep it as XLS
   fExt = ".XLS" 

   'generates a random number for every saved XLS file.
   'This will ensure that each filename is unique.
   forceRand = True 

   'If a file with the same filename exists, Integra will not overwrite
   ovrWrite = False 

   stats.filename = GetRandomFileName(path,fPrefx,fExt,forceRand,ovrWrite) 


case CB_BFORREADNOTES
case CB_BFORREADCOM
case CB_BFORWRITECOM
case CB_BFORWRITENOTES
case CB_BFORCOMACTION
case CB_BFORNOTESACTION 
case CB_TERMINATE
end select 

.




FAQ# 0262
Bookmark and Share

 
QUICK LINKS
 
 

 

  © Shireburn Software Ltd. 2008 - 2024