Results 1 to 3 of 3

Thread: Subscript Out Of Range

  1. #1

    Thread Starter
    New Member
    Join Date
    Dec 2006
    Posts
    2

    Unhappy Subscript Out Of Range

    I receive a Subscript Out Of Range error when calling a 3rd party COM module. I recieve the error on the highlighted line below.

    Option Explicit

    Dim FiscalEpson As EpsonFiscal
    Dim result As Long

    Private Sub Command1_Click()
    Dim result As Long
    Dim result2 As Variant

    Dim port As Long
    Dim file As String
    Dim file2 As String

    Dim FiscalEpson As EpsonFiscal

    file = "c:\fiscal.txt"
    file2 = ""
    port = 1
    Set FiscalEpson = New EpsonFiscal


    result = FiscalEpson.OpenFiscalPort(port)
    result = FiscalEpson.PrintData(file, file2)
    result = FiscalEpson.PrintNonFiscalData(file)

    result2 = FiscalEpson.GetVersion()

    Set FiscalEpson = Nothing



    End Sub


    I use the same module in Visual C++ without any errors.

    Here is a snippet from the .tlh file that was generated from my C++ compile:

    struct __declspec(uuid("0a540171-7ece-403e-a354-7effd812a4eb"))
    _EpsonFiscal : IDispatch
    {
    //
    // Wrapper methods for error-handling
    //

    long OpenFiscalPort (
    long portNumber );
    long PrintData (
    _bstr_t fileToPrint,
    _bstr_t fileCMRToPrint );
    long ResumePrinting ( );
    long GetLastError (
    BSTR * bufferOut );
    long PrintNonFiscalData (
    _bstr_t fileToPrint );
    _bstr_t GetVersion ( );

    //
    // Raw methods provided by interface
    //


    When calling the PrintNonFiscalData function I don't receive any errors.

    Any ideas?

  2. #2
    Just Married shakti5385's Avatar
    Join Date
    Mar 2006
    Location
    Udaipur,Rajasthan(INDIA)
    Posts
    3,747

    Thumbs up Re: Subscript Out Of Range

    Welcome On the Forums
    Add Microsoft Scripting run time in your project -> add reference

  3. #3

    Thread Starter
    New Member
    Join Date
    Dec 2006
    Posts
    2

    Re: Subscript Out Of Range

    Thanks for the quick reply.

    I added the reference "Microsoft Scripting Runtime" but still have the same results.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width