The Addon will provide some functionality to control Microsoft Office. To use this code, Office needs to be installed on your computer. To get general data from Excel or Access, it is recommended to use AddonDB and use the OleDB functionality. This AddOn contains some specific functions that has been used to automate administration, like automatic creating and sending email messages, creating Word documents, based on Access databases, etc.



Functions


MSEAddModule(ExcelFile As String, ModuleName As String, Code As String) As Boolean

MSERemoveModule(ExcelFile As String, ModuleName As String) As Boolean

MSERunCode(FileName As String, Procedure As String, _

                          Optional AccessVisible As Boolean = False, _

                          Optional Arg1 As Object = Nothing, _

                          ……

                          Optional Arg10 As Object = Nothing) As Object

Runs Code in Excel.


MSCreateWordReport(Template As String, Database As String, SQL As String, _

                                         OutputMap As String, FieldNameInDoc As String) As String

MSCreateWordReport(Template As String, ByVal XMLinput As String, _

                                          SaveAs As String) As String

XMLInput is a string in the following format:

<Word>

      <VarName>value</VarName>

      …..

      <AnotherVar>another value</AnotherVar>

</Word>

Within the word template, all text with ‘#VARNAME#’ and ‘#ANOTHERVAR#’ will be replaced with their values. SaveAs contains the name of the created document.


MSSendMail(fileName As String, XMLinput As String, _

                        Optional Action As Integer = 1) As String


Filename is the name of the template message (.msg or .oft)

XMLInput is a string in the following format, all tags are optional:

<Mail>

   <TO>info@lydo.nl</TO>   ‘email address of recipient(s)

   <CC></CC> ‘email address of CC recipients(s)

   <BCC></BCC> ‘email address of BCC recipients(s)

   <Subject>Test</Subject>

   <Importance>HIGH</Importance>  ‘LOW or 0, HIGH or 2, NORMAL or 1

   <ID>234</ID> ‘Saves an ID in categories field, used by other program

   <Categories>category name</Categories>

   <Attachement>C:\Picture.jpg</Attachement> ‘Filename of attachement

   <VarName>replace</VarName>

</Mail>


Also tags HTMLBody and Body can be used to set the complete message, but this is normally not used.

Actions:        Save = 1,   Display = 2,   Send = 3

MSGetMail(fileName As String) As String

Returns the XML Data for a message.

MSSendDrafts(Optional CheckID As Boolean = False) As Integer

Sends all messages in the drafts folder. With CheckID set, only the messages with an ID set in the categories field will be send.

MSBuildHtmlTable(MDBFilename As String, SQL As String) As String

Returns a table from a MDB SQL in HTML format. This table can then be inserted in a message.


MSARunCode(FileName As String, Procedure As String, _

                          Optional AccessVisible As Boolean = False, _

                          Optional Arg1 As Object = Nothing, _

                          ……

                          Optional Arg10 As Object = Nothing) As Object

Runs code in Access

MSARunMacro(FileName As String, Procedure As String, _

                            Optional AccessVisible As Boolean = False) As String

MSAOpenReport(FileName As String, ReportName As String, _

                                Optional print As Boolean = False) As String

MSAOpenQuery(FileName As String, QryName As String) As String

MSACreateQuery(Filename As String, QryName As String, SQL As String) As String

Excel2MDB(FileMDB As String, TblName As String, FileXLS As String, _

                     Optional MakeVisible As Integer = 2) As String

MakeVisible:     HIDE = 1,  MINIMIZED = 2,   MAXIMIZED = 3

MDB2Excel(FileMDB As String, TblName As String, FileXLS As String, _

                      Optional MakeVisible As Integer = 2, _

                       Optional SpreadSheetType As Integer = -1) As String

MakeVisible          :     HIDE = 1,  MINIMIZED = 2,   MAXIMIZED = 3

SpreadSheetType:  0: Excel 3.0 format

                 6: Excel 4.0 format

                 5: Excel 5.0 format / Excel 95 format

                 8: Excel 97 format / Excel 2000 format

                 9: Excel 2010 format

                10: Excel 2010 XML format

                -1:Automatic 97 or 2010XML, based on extension

                -2:Default format

MSASetUserProp(DBFile As String, propName As String, propValue As String) As String

MSAGetUserProp(DBFile As String, propName As String) As String

MSASetSummaryProp(DBFile As String, propName As String, propValue As String) As String

MSAGetSummaryProp(DBFile As String, propName As String) As String

GetPropertiesInfo(DBFile As String) As String

MSASetTableLink(mdbSource As String, mdbTarget As String, tblName As String) As String



Created with the Personal Edition of HelpNDoc: News and information about help authoring tools and software