ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Help "438 - Object doesn't support this property or method" (https://www.excelbanter.com/excel-programming/339402-help-438-object-doesnt-support-property-method.html)

Revtim

Help "438 - Object doesn't support this property or method"
 
Hello,

My code is getting the error '438 - Object doesn't support this
property or method' in my VBA Excel app that uses a web service. I
suspect, however, that the problem is a basic VBA one, as I am not very
familiar with VBA.

I created the objects via the Web Services Reference tools (referencing
the URL of the WSDL) with no problems, and got the following class
modules:

clws_Factory_CustomerQuery
clws_CustomerQuery
struct_AniDnis
struct_QueryResult

I made objects from these classes (skipping the factory) as follows:
Dim CustQuery As New clsws_CustomerQuery
Dim Query_Input As New struct_AniDnis
Dim Query_Output As New struct_QueryResult

When I run the code, I get the '438 - Object doesn't support this
property or method' error when I call the method that actually does the
query:

Query_Output = CustQuery.wsm_getDnis(Query_Input)

When I type the dot after CustQuery, it gives me the wsm_getDnis
method, so I know it has this method, and at some level VBA knows it
has this method. Just not at runtime, for some reason.

The wsm_getDnis method is defined in the generated
clsws_CustomerQueryclass module as follows:

Public Function wsm_getDnis(ByVal obj_requestInfo As
struct_AniDnis) As struct_QueryResult

I wonder if perhaps I am passing the Query_Input value incorrectly, due
to my lack of VBA experience.

Thanks much,
Tim

(the following is the entire method I wrote)
==================================================
Private Sub Execute_Query_Click()

Dim CustQuery As New clsws_CustomerQuery
Dim Query_Input As New struct_AniDnis
Dim Query_Output As New struct_QueryResult

Query_Input.Ani = "5612186545"
Query_Input.DestNumber = "5615426969"
Query_Output.Result = 0
Query_Output.Dnis = "NORESULT"
Query_Output.Pin = "NORESULT"

'grab values from spreadsheet
If Not IsEmpty("B3") Then
Query_Input.Ani = Val(Range("B3").Text)
If Not IsEmpty("B4") Then
Query_Input.DestNumber = Val(Range("B4").Text)
End If
End If

' Execute query
Query_Output = CustQuery.wsm_getDnis(Query_Input)

Range("B7").Value = Query_Output.Result
Range("B8").Value = Query_Output.Dnis
Range("B9").Value = Query_Output.Pin
End Sub
==================================================



All times are GMT +1. The time now is 12:59 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com