Гость
Целевая тема:
Создать новую тему:
Автор:
Форумы / Visual Basic [игнор отключен] [закрыт для гостей] / Properties для Excel / 3 сообщений из 3, страница 1 из 1
19.01.2004, 14:21
    #32380325
Alexey_777
Гость
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Properties для Excel
1. Есть xls-файл (Excel 2002) Book1 с листом List1. И есть код
Private Sub Form_Load()

On Error GoTo mError:

Dim cnn As ADODB.Connection
Dim cat As ADOX.Catalog
Dim tbl As ADOX.Table

Set cnn = New ADODB.Connection

cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\A\Work\Excel\Book1.xls;Extended Properties=Excel 8.0;Persist Security Info=False"

Set cat = New ADOX.Catalog

cat.ActiveConnection = cnn

Dim vTableName As String

Dim vPropVal As Variant
Dim sPropName As String
Dim sPropType As String

Set tbl = cat.Tables(0)

vTableName = tbl.Name
sName = tbl.Properties(0).Name
sType = tbl.Properties(0).Type
vVal = tbl.Properties(0).Value


mError:

Dim lErrNumber As Long
Dim sDescription As String
Dim sSource As String

lErrNumber = Err.Number
sDescription = Err.Description
sSource = Err.Source

End Sub

Точка останова ставилась на End Sub. При попытке выполнить
vVal = tbl.Properties(0).Value выскакивал Exception.

Результата работы в окне Watches следующий:

Expression Value

lErrNumber -2147467259
sDescription "Неопознанная ошибка"
sSource "Microsoft JET Database Engine"
sName "Temporary Table"
sType 11
vTableName "List1$"
vVal Empty

Возможно ли считывание свойств Microsoft JET Database Engine
для Excel и если да, то как это сделать.
...
Рейтинг: 0 / 0
21.01.2004, 19:29
    #32383802
Processor
Участник
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Properties для Excel
См. ADO API Reference, Properties Collection:
Contains all the Property objects for a specific instance of an object.
Remarks
Some ADO objects have a Properties collection made up of Property objects. Each Property object corresponds to a characteristic of the ADO object specific to the provider.

Note See the Property object topic for a more detailed explanation of how to use Property objects.

The Dynamic Properties of the Recordset object go out of scope (become unavailable) when the Recordset is closed.

See Also
Properties, Methods, and Events | Property Object | Appendix A: Providers
...
Рейтинг: 0 / 0
22.01.2004, 18:45
    #32385198
Alexey_777
Гость
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Properties для Excel
Ну и ????????????!!!!!!!!!!!!!!!!!!!!!!
...
Рейтинг: 0 / 0
Форумы / Visual Basic [игнор отключен] [закрыт для гостей] / Properties для Excel / 3 сообщений из 3, страница 1 из 1
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]