Jump to content

aerospatiale

Member
  • Posts

    1
  • Joined

  • Last visited

  • Donations

    0.00 USD 
  • Country

    United Kingdom

About aerospatiale

Profile Information

  • OS
    XP Pro x86

aerospatiale's Achievements

0

Reputation

  1. Hello, I currently have the script (reprinted at the end of this post), which works when calling a VBA macro (which accepts parameters in Excel). The problem however is when I modify the App.Run line to accept the input parameter objects that I have picked up from the command line instead of string literals (commented out in the code below). When I do this, I receive the following error. Error: 13 Error (Hex): D Source: Microsoft VBScript runtime error Description: Type mismatch How can I correct this (if possible)?? My script: Dim app ' Application object handle Dim wb ' Workbook object handle dataFilePath = WScript.Arguments.Item(0) macroName = WScript.Arguments.Item(1) inputFilePath = WScript.Arguments.Item(2) dataParam1 = WScript.Arguments.Item(3) ' Assign the application object handle to an Excel instance Set app = CreateObject("Excel.Application") ' Ensure that the user isn't bothered by the temporary instance of Excel app.Visible = False app.DisplayAlerts = False ' Open the workbook containing the relevant macros to be run On Error Resume Next Set wb = app.Workbooks.Open(dataFilePath) If Err.Number <> 0 Then Call reportError End If ' I would prefer to type the more dynamic: app.Run macroName, inputFilePath, dataParam1 app.Run "literalMacroName", "literalInputFilePath", "literalDataParam1" If Err.Number <> 0 Then Call reportError End If
×
×
  • Create New...