Anyone using the AddCampaigns, AddOrders, etc from Excel using VBA?

Good Morning fellow developers,
I have a fully functioning desktop integration to the API's via Excel 2003, VBA and .NET that stopped working upon moving from the V1 to the V3.x version of the API's. These applications no longer function due to the mandated migration from .NET 1.1 to .NET 2.0.

The simple VBA app uses the .NET app to perform the API calls, upon completion, the .NET function returned the EntityResultType enumeration results, the ID's for the successfully completed campaigns. The campaign IDs are then added to the worksheet and are then used for the AddOrders and the process continues for the AddOrderItem. This tight desktop integration was designed by our tacticians in order to easily mass update/add/delete their numerous accounts' campaigns.

I have been struggling with rectifying this break and thought perhaps someone else on this list was using a similar methodology to manage their accounts, and may be able to quickly assist.
Please let me know if you have any solutions, I've basically come to the point where I will have to scrap this system and migrate to a solution that leverages Visual Studio Tools for Office or a third party spreadsheet solution like Spreadsheet Gear.

<VBA code>
Public Sub MSNAddTemplateCampaigns(ByVal AccountID As Long, ByRef
MonthlyBudget As Long)

Dim API As New ADcenter.API
Dim result As Object
Dim Row As Integer
Dim aResults() As Long
Dim Campaigns() As ADcenter.AdCenterCampaign
Dim var As Variant
Dim sheet As Worksheet
Dim intI As Integer
Dim sCampaignName As String

On Error GoTo errhndle
Application.ScreenUpdating = False

Set sheet = Sheets(CampaignsSheetName)
'Build Campaigns object to send to API.AddCampaigns

MSNTemplateCreateCampaignsObject Campaigns, MonthlyBudget

'Define Variant var to be equal to the Campaigns() just created and pass
into AddCampaigns API

var = Campaigns

Set result = API.AddCampaigns(AccountID, var)

aResults = result
sheet.Cells(19, 1) = "Campaign ID"
Row = 21
For i = LBound(aResults) To UBound(aResults)
If aResults(i) <> "0" Then
'Store the newly created campaign ids
If sCampaignName <> var(aResults(i)).CampaignName Then
sCampaignName = var(aResults(i)).CampaignName
MsgBox "Finished Adding Campaign: " & sCampaignName, vbOKOnly,
"MSN AdCenter"
End If

Do While sheet.Cells(Row, 3) <> ""
If LCase(Trim(sheet.Cells(Row, 3))) = LCase(var(i).CampaignName)
Then
sheet.Cells(Row, 1) = aResults(i)
End If
Row = Row + 1
Loop

End If
Next i

MSNHandleAPIErrors result, "addcampaigns", var
Set API = Nothing
Exit Sub

Application.ScreenUpdating = True

errhndle: MsgBox Err.Description, vbOKOnly, Err.Number

Set API = Nothing

End Sub

</code>

This throws an error, 424 Object Required, after successfully completing the API.AddCampaigns(AccountID, var) the account has the campaign as via the GUI, and attempting to return to the calling app.


<.NET code>

Public Function AddCampaigns(ByVal accountID As Integer, ByRef
Campaigns As Object) As Object Implements _main.AddCampaigns

Dim pAPI As CampaignManagement = New CampaignManagement
SetAuthCredentials(pAPI)
Dim i As Integer
Dim lCampaigns() As AdCenterCampaign
ReDim lCampaigns(UBound(Campaigns) - LBound(Campaigns))
Dim aResults() As Long
ReDim aResults(UBound(Campaigns) - LBound(Campaigns))
Dim result As EntityResultType = New EntityResultType

For i = LBound(Campaigns) To UBound(Campaigns)
lCampaigns(i - -LBound(Campaigns)) = Campaigns(i)
aResults(i) = 0
Next i

Try

result = pAPI.AddCampaigns(0, accountID, lCampaigns)

'Handle the Campaigns created successfully
'created.Id is the Campaign ID;
'created.Index is the corresponding index into Campaign

For Each created As EntitySuccessType In result.SuccessRow
aResults(created.Index) = created.Id
Next

AddCampaigns = aResults

Catch e As Exception

WriteToEventLog(accountID & ":" & lCampaigns(0).CampaignId &
lCampaigns(0).CampaignName & ":" & accountID & ":" & UBound(Campaigns) & ":"
& LBound(Campaigns) & ":i=" & i & ":" & e.Message & ":" & e.Source & ":" &
e.StackTrace)

End Try
pAPI = Nothing

End Function

</.NET code>



Previously the .NET code simply returned the EntityResultType via AddCampaigns = pAPI.AddCampaigns(0, accountID, lCampaigns) and the VBA code walked through the results.

Set result = API.AddCampaigns(AccountID, var)
Dim created() As EntitySuccessType
created = result.SuccessRow


The V3.x migration prohibited this, so I have attempted to return an array of ID's from the .NET to the VBA. This is very confusing since it was a fully functioning app prior to the migration. How can I quickly remedy this

Thanks in advance for your time if you have read to this point and can lend a hand,
David


Answer this question

Anyone using the AddCampaigns, AddOrders, etc from Excel using VBA?

  • shmulik_segal

    Good Morning Shai,

    Do you have any updates or time frame for updates on this If the patch is not ready before the end of life for the API V2, will you extend the V2 to prevent disruption of services

    Thanks in advance,

    David


  • Av0id

    V3 should be working now for .NET 1.1 users - we released the fix a couple of weeks ago.

    We will continue to support V2 for the next several weeks at least, to give people more time to move gradually into V3.

    Thanks!

    Shai


  • Ace_Balasador

    There is no mandated migration from .NET 1.1 to .NET 2.0.

    Currently, there is a known issue in adCenter API v3.0 that prevent .NET 1.1 callers from using it -- we will deploy a fix shortly. In the meantime, please try to run against adCenter API v2.0 and see if that solves the problem.

    Thanks!

    Shai


  • MSP.Saami

    Fantastic! I rebuilt my apps using the .NET1.1 VS 2003 and the V2 API worked.

    I'll have to do a more thorough review of the release notes.

    David

  • Anyone using the AddCampaigns, AddOrders, etc from Excel using VBA?