Quickbooks SDK Part IV

Part I: Introduction and Controlling Procedure
Part II: Creating the Quickbooks Queries
Part III: Filling Class Modules
Part IV: Writing to Worksheets

In the last part, I take the collection of custom objects from Part III and write each object to a worksheet. For instance, I filled a collection with CSalesOrder objects and now I pass that collection to the following procedure. It accesses the properties of the CSalesOrder class to determine if that specific sales order belongs on the backorder report and writes certain columns to a table on the worksheet wshSO.

I can pass this same collection to the WriteRepairs procedure where I can get at the sales orders that have been designated as repairs.

At the end of the “write” procedures, I call the AdjustNames procedure, passing it an array of headings and the number of the last row to which I wrote data. This procedure adjusts the defined names on the worksheet, which have the same name as the heading, to encompass all of the data.

At this point, I have several worksheets of data that I can access with formulas and summarize however I wish.

Download QBMRP.zip.

<< Part III

7 thoughts on “Quickbooks SDK Part IV

  1. Hi Dick – tried downloading the zip file indicated to have a look, and it’s not having any of it!

  2. marvellous, all downloaded to be looked at over the weekend – dodgy color schemes and all!

  3. Hello Dick,

    The following code is working fine in owc.spreadsheet component version 9 but not working fine when i use owc11.spreadsheet component.

    sub subWriteHeader

    with objExcel.Range(“C1:E1?)
    .Borders.Color = “black”
    .Interior.Color = “white”
    .Font.Bold = “true”
    .Borders.Weight = 2
    .Font.Size = “12?
    .Font.Color = “Darkblue”
    .value = “WWAS Active Delegations”
    end with

    with objExcel.Range(“C4:C4?)
    .Font.Color = “green”
    .Font.Size= “12?
    .Value= “Limits Displayed In US Dollars”
    end with

    with objExcel.Range(“A5:N5?)

    .Borders.Color = “black”
    .Interior.Color = “LightSteelBlue”
    .Borders.Weight = 1
    .Font.Size = “12?
    .Font.Color = “white”
    end with

    objExcel.Cells(5, 1).Value = “Authorizer”
    objExcel.Cells(5, 2).Value = “Authorizer Emp#”
    objExcel.Cells(5, 3).Value = “Location Code”
    objExcel.Cells(5, 4).Value = “MRU Code”
    objExcel.Cells(5, 5).Value = “General Expenses”
    objExcel.Cells(5, 6).Value = “Capital Purchases”
    objExcel.Cells(5, 7).Value = “Business Case Name”
    objExcel.Cells(5, 8).Value = “Business Case Limit”
    objExcel.Cells(5, 9).Value = “Delegate”
    objExcel.Cells(5, 10).Value = “Delegate Emp#”
    objExcel.Cells(5, 11).Value = “Delegate Email”
    objExcel.Cells(5, 12).Value = “Delegate Phone”
    objExcel.Cells(5, 13).Value = “From Date”
    objExcel.Cells(5, 14).Value = “To Date”

    end sub

    The cell preoperties and the headers are not setting.

    Please can you give me a clue what could be the problem.


  4. B-E-A-U-T-I-F-U-L. (and clearly written blog & coding)

    Nice summary and use of vba to access and enumerate your QB data.

    Saved me hours of pawing, sucking, and chewing on the rather terse IDN info.

    Thanks much-o for the sample code!

    dave m

  5. Dear Dick,

    I enjoyed your tutorial and I downloaded your zip file and toyed around with with the code to understand your usage. I am currently working on capturing information from quickbooks for use in MS Access. I am needed the “Duration” field in the timetrackingquery. I have a working xml file that, when I use the SDK test utility, successfully creates an xml response that contains the Duration field. eg PT4H30M0S. I then save that xml file. I have writen vba code to import the xml into Excel and run through several operation that turns that Duration value into 4.5

    I would love to find a way to capture this query from QB from Excel VBA. If tried to rewrite your code, but I run into an Argument error when I hit the line of code that contains Duration.GetValue

    Since I know the xml file can get the data, I know QB will supply it. I would really love any help you can provide so I can send the xml request and process the response from within Excel’s VBA.


  6. Scott: What is the exact text of the error message you’re getting. Also, if you can, send the code you’re using to dkusleika@gmail.com. I don’t know if I have time tracking set up here, but I might be able to spot something in the code.

Posting code? Use <pre> tags for VBA and <code> tags for inline.

Leave a Reply

Your email address will not be published.