Найти - Пользователи
Полная версия: Использование Activex в программе
Начало » Python для новичков » Использование Activex в программе
1
StasPyton
Здрасте.
Есть у меня dll-ка Activex. Написанная на VBA.Мне ее надо использовать в проге.
Я установил pywin32. Запустил makepy.py, нашел свою библиотеку. Получил wrapper файлы. И пытаюсь вставить это в свою прогу:

import win32com.client
import pythoncom
Cmd = win32com.client.Dispatch(“ATL 2.0 Type Library”)

На что получаю ошибку - Недопустимая строка с указанием класса

Что не так?
Lolka
Навскидку – аргументом для Dispatch скорее всего является имя класса или путь к нему, разделенный точкой, но не имя строкой.

Например, здесь говорят: http://oreilly.com/catalog/pythonwin32/chapter/ch12.html

This method takes as its first parameter the ProgID or CLSID of the object you wish to create. If you read the documentation for Microsoft Excel, you'll find the ProgID for Excel is Excel.Application, so to create an object that interfaces to Excel, use the following code:

>>> import win32com.client
>>> xl = win32com.client.Dispatch("Excel.Application")
>>>
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB