PDA

View Full Version : Want to convert vb.net code to Excel vba



skb
04-11-2013, 12:30 PM
Want to convert following code to excel vba.
I get error on

Dim idoDataSet As dataset - saying invalid data type





Dim sessionToken As String
Dim idoDataSet As dataset

Dim idoWS As New clsws_IDOWebService
sessionToken = idoWS.CreateSessionToken("user", "password", "dev1_phil")
idows.wsm_LoadDataSet(sessionToken, "SLCustomers", "Name, CustNum, CustSeq", "", "", "", 0)
idoDataSet = idoWS.LoadDataSet(sessionToken, "SLCustomers", "Name, CustNum, CustSeq", "", "", "", 0)
DataGridView1.DataMember = idoDataSet.Tables(0).TableName
DataGridView1.DataSource = idoDataSet

SamT
05-26-2013, 10:43 AM
This is from my version of MS Access Help


Using ADO with ADO MD

ADO and ADO MD are related but separate object models. ADO provides objects for connecting to data sources, executing commands, retrieving tabular data and schema metadata in a tabular format, and viewing provider (http://www.vbaexpress.com/forum/mddefglossary.htm#mddefdataprovider) error information. ADO MD provides objects for retrieving multidimensional data and viewing multidimensional schema metadata.
When working with an MDP you may choose to use ADO, ADO MD, or both with your application. By referencing both libraries within your project, you will have full access to the functionality provided by your MDP.
It is often useful for consumers to get a flattened, tabular view of a multidimensional dataset. You can do this by using the ADO Recordset (http://www.vbaexpress.com/forum/mdobjodbrec.htm) object. Specify the source for your Cellset (http://www.vbaexpress.com/forum/amobjcellset.htm) as the Source parameter for the Open (http://www.vbaexpress.com/forum/mdmthrstopen.htm) method of a Recordset, rather than as the source for an ADO MD Cellset.
It may also be useful to view the schema metadata in a tabular view rather than as a hierarchy of objects. The ADO OpenSchema (http://www.vbaexpress.com/forum/mdmthopenschema.htm) method on the Connection (http://www.vbaexpress.com/forum/mdobjconnection.htm) object allows the user to open a Recordset containing schema information. The QueryType parameter of the OpenSchema method has several SchemaEnum (http://www.vbaexpress.com/forum/mdcstschemaenum.htm) values that relate specifically to MDPs. These values are:
adSchemaCubes
adSchemaDimensions
adSchemaHierarchies
adSchemaLevels
adSchemaMeasures
adSchemaMembersTo use ADO enum values with ADO MD properties or methods, your project must reference both the ADO and ADO MD libraries. For example, you can use the ADO adState enum values with the ADO MD State (http://www.vbaexpress.com/forum/amprostate.htm) property. For more information about establishing references to libraries, see the documentation of your development tool.
For more information about the ADO objects and methods, see the ADO API Reference (http://www.vbaexpress.com/forum/mdmscadoapireference.htm).
See Also

ADO MD Object Model (http://www.vbaexpress.com/forum/ammscobjectmodel.htm) | Microsoft ADO MD Programmer's Reference (http://www.vbaexpress.com/forum/ammscadomdoverview.htm) | Overview of Multidimensional Schemas and Data (http://www.vbaexpress.com/forum/ammscoverviewmdschemasanddata.htm) | Programming with ADO MD (http://www.vbaexpress.com/forum/ammscprogrammingwithadomd.htm) | Working with Multidimensional Data (http://www.vbaexpress.com/forum/ammscworkingwithmddata.htm)




© 1998-2003 Microsoft Corporation. All rights reserved. (http://www.vbaexpress.com/forum/ado_sdk_copyright_and_trademarks.htm)


This line of your codeDim idoWS As New clsws_IDOWebServiceTells me that there is another code module that you haven't shown us.

stanl
05-28-2013, 05:43 AM
Want to convert following code to excel vba.
I get error on

Dim idoDataSet As dataset - saying invalid data type




I don't think it is possible as you are mixing COM and .NET

http://social.msdn.microsoft.com/forums/en-US/vsto/thread/35794d8e-b5b0-4f57-9a50-4de79643d185/

The code you posted appears to reference a web service. Is there an API documentation for that web service; if so you can probably use VBA via an HTTP GET. Just .02

Stan