Comments

1 comment

  • Avatar
    wojciechka

    InstallBuilder does not provide built-in actions to perform such actions and we do not recommend performing such complex things as reading XLS files and depending on it in the installer. We recommend using XML or INI files and using <iniFileGet> and<xmlfileget>` actions.

    However, if the installer is always run on machines where Microsoft Office is already installed, it is possible to run cscript and access Microsoft Office from Visual Basic.

    Below is an InstallBuilder sample that unpacks and runs a .vbs script:

    <unpackFile> <component>xlstest</component> <destination>${system_temp_directory}\xlstest.vbs</destination> <folder>xlstest</folder> <origin>xlstest.vbs</origin> </unpackFile> <runProgram> <program>cscript</program> <programArguments>/NOLOGO "${system_temp_directory.dos}/xlstest.vbs"</programArguments> </runProgram> <deleteFile> <path>${system_temp_directory}\xlstest.vbs</path> </deleteFile> <showInfo> <text>Output from cscript: ${program_stdout} </text> </showInfo>

    Below is an example Visual Basic code of printing value of A1 cell in Sheet1 of xlsfile.xls file in current directory:

    Dim ExcelApp As Excel.Application, XlsBook As Excel.Workbook, XlsSheet As Excel.Worksheet Set ExcelApp = New Excel.Application Set XlsBook = ExcelApp.Workbooks.Open("xlsfile.xls") Set XlsSheet = XlsBook.Worksheets("Sheet1") WScript.Print XlsSheet.Cells(1, 1).Value ExcelApp.Quit

Please sign in to leave a comment.