Dim Wb As New WinbooksObject

Private Sub Form_Unload(Cancel As Integer)
Wb.CloseDossier
End Sub
Private Sub Import_Click()
'Initialisation
Dim i As Integer
If Wb.Init <> 0 Then MsgBox Wb.LastErrorMessage: Exit Sub
'User login
If Wb.Login("SYSTEM", "") <> 0 Then MsgBox Wb.LastErrorMessage: Exit Sub
'Opening of the PARFILUX folder
If Wb.OpenDossier("PARFILUX") <> 0 Then MsgBox Wb.LastErrorMessage: Exit Sub
'For the 1999 bookyear
If Wb.OpenBookYear("Ex. 1999") <> 0 Then MsgBox Wb.LastErrorMessage: Exit Sub
'Import in the DBF format
If Wb.Import.FileFormat("DBF") = False Then MsgBox Wb.LastErrorMessage: Exit Sub
'Specification of the directory with the imported files
If Wb.Import.Directory(App.Path & "\ImportFiles") = False Then MsgBox Wb.LastErrorMessage: Exit Sub
'Specification of original format
wb.import.linkformat=wbWinbooks
'Ask a backup of the data and of the imported files
If Wb.Import.Backup(App.Path & "\Backup") = False Then
MsgBox Wb.LastErrorMessage
Exit Sub
End If
'We import the invoices of December
If Wb.Import.SetDefaultPeriod(Wb.Param.PeriodInternalCode("01/12/1999")) = False Then MsgBox Wb.LastErrorMessage: Exit Sub
'Handling of the errors
'Missing account: blank form
Wb.Import.ErrorCodes("ACC_MISS").SetResolution = wbBlankRecord
'Changed memo: replace with the imported memo
Wb.Import.ErrorCodes("MEM_DIFF").SetResolution = wbReplace
'Modified form: take the content of the imported form
Wb.Import.ErrorCodes("ACC_MOD").SetResolution = wbReplace
'Rupture in the sequence of number : report it : we leave it at WbToResolve
Wb.Import.ErrorCodes("SEQ_RUPT").SetResolution = wbToResolve
'A document already exist in the target folder : replace
Wb.Import.ErrorCodes("DOC_NUM").SetResolution = wbReplace
'The label of a table's code has changed : replace with imported label
Wb.Import.ErrorCodes("TAB_MOD").SetResolution = wbReplace
'Different rate for this currency : take the imported rate
Wb.Import.ErrorCodes("CUR_ERR").SetResolution = wbReplace
'The imported file is strictly identical to the target file : continue
Wb.Import.ErrorCodes("SAM_FIL").SetResolution = wbAccept
'Records with off-period dates : accept
Wb.Import.ErrorCodes("OUT_DAT").SetResolution = wbAccept

'We launch the test procedure
If Wb.Import.test = False Then MsgBox "Error during the test procedure": Exit Sub
For i = 1 To Wb.Import.Warnings.Count
If Wb.Import.Warnings(info) .GetResolution = 0 Then
MsgBox "Every warning is not resolved (" & Wb.Import.Warnings(info) .Code & ")"
End If
Next i
Wb.Import.ErrorCodes("SEQ_RUPT").SetResolution = wbAccept
If Wb.Import.FatalErrors.Count > 0 Then MsgBox "Fatal errors in the imported files. Unable to continue!": Exit Sub
If Wb.Import.Warnings.Count > 0 Then MsgBox "Warning errors in the imported files"
If Wb.Import.Execute = 0 Then
MsgBox "Import is successfully done"
Else
MsgBox Wb.LastErrorMessage
End If
Wb.CloseDossier
End Sub

Examples of sale invoices in the imported ACT



Examples of purchase invoices in the imported ACT



Examples of principal bookings in the imported ACT



Examples of cash in book movements in the imported ACT



Examples of financial movements in the imported ACT



Example of a sale to import from a TXT file


Example of a purchase to import from a TXT file


Example of a principal booking to import from a TXT file


Example of a financial booking to import from a TXT file



The 'Word Wrap' function of Notepad is used for the needs of this documentation. A line in the ACT is shown here on several lines. In the TXT file, a line is separated by a line return. For example: on the last screenshot, "1, ING, ... ,,,,,,,,,," is only one line of the ACT.

  • No labels