Introduction
Upon request to axes4, it is possible to automate the output of axesWord using VBA macros. The following sample code documents the procedure:
Sample code
Sub ExportAsPDF()
Dim addin As COMAddIn
Dim returnValue As Variant
Dim path As String
Dim title As String
Dim language As String
Dim exportAsPDFA As Boolean
Dim supressFieldsUpdate As Boolean
Dim supressPagination As Boolean
Dim lastError As String
path = "[PATH]"
title = "[TITLE]"
language = "[LANGUAGE]"
exportAsPDFA = False
supressFieldsUpdate = False
supressPagination = False
Set addin = Application.COMAddIns.Item("axesWord.Addin")
If Not addin.Connect Then
' Add-in is not connected; the user must enable it manually
Exit Sub
End If
returnValue = addin.Object.Export(path, title, language,supressFieldsUpdate,supressPagination, exportAsPDFA)
lastError = ""
' Error occurred
If returnValue = 2 Then
On Error Resume Next
lastError = addin.Object.GetLastError()
End If
Exit Sub
End SubReturn values
// internal usage only
Undefined = -1;
// ─────────────────────────────
// General
// ─────────────────────────────
Success = 0;
WaitingForCompletion = 1;
ErrorOccurred = 2;
// ─────────────────────────────
// Licensing
// ─────────────────────────────
Licensing_NotInitialized = 100;
Licensing_NotLicensed = 101;
Licensing_LoginRequired = 102;
LicensingFeature_Automation_NotLicensed = 110;
// ─────────────────────────────
// Office API
// ─────────────────────────────
OfficeApi_Disconnected = 200;
// ─────────────────────────────
// Document Status
// ─────────────────────────────
Document_NotOpen = 300;
Document_NotActive = 301;
Document_NotSaved = 302;
Document_NotSavedLocal = 303;
Document_CompatibilityModeActive = 304;
Document_ReadOnly = 305;