Has anybody gotten win32com to work in python for revit

I have been able to install the pypiwin32 on my pc in vs code but am having some issues moving it over to our network. The specific error i am getting is "Warning: ImportError : DLL load failed while importing _win32sysloader: The specified module could not be found. "

Hello @richard.bruceTKMW9

this has a relationship with DynamoBIM ?

Yes I am trying to get it to work in dynamo in revit.

Maybe you can try with comtypes

import sys
import clr

import Python.Included as pyInc
path_py3_lib = pyInc.Installer.EmbeddedPythonHome
sys.path.append(path_py3_lib + r'\Lib\site-packages')

from comtypes.client import CreateObject
from comtypes.gen.Excel import xlRangeValueDefault

xl = CreateObject("Excel.Application")
xl.Visible = True
sh = xl.Workbooks[1].Sheets["Feuil1"]
# write value
sh.Cells.Item[1,1].Value[()] = "Hello World!"
# read value
test = sh.Cells.Item[1,1].Value()

OUT = test

help link to install python package in DynamoBim

1 Like

So that is part of the problem I am trying to get this to work on a network drive not from my c drive, or are you telling me I have to install it on everybody’s Pc in that location.

This is likely going to be a requirement as it’s a standard practice to block execution of remote code, and while you may be able to get such setups working today for is unlikely to stay as such for long. Packaging the node in question and deploying the relevant libraries it requires is likely going to be a must in the long run.

Thank you both I think the comtypes is going to work for me, I just need to figure out how to send information to an outlook email.

Hearing that you are after that, this may be relevant to your interests:

thank you but i have actually already watched that video it is close to what I want. I need outlook to actually open a new message and transfer data over to it.

You want the UI to allow users to edit the message?