[python-win32] Run solidworks macro from python.

Sanaa Mouzahir sm5126 at columbia.edu
Wed Feb 9 19:36:32 EST 2022


Hello. I have started a project in which I have to link both solidworks and
python. I want to use Pywin32 to run a macro from python. here is my code:

app=win32com.client.Dispatch("SldWorks.Application")
app.OpenDoc("C:/Users/sm5126/Downloads/Python/Python/Part1.SLDPRT", 1)
app.Run("C:/Users/sm5126/Downloads/Python/Python/Part1.SLDPRT!ForceRebuild.swp")

I basically want to use the same run function as for excel. But it does not
work. Is there a way to run a macro from python using Pywin32?
Thank you so much already.
Cheers,
Sanaa


-- 
*Sanaa Mouzahir*
*Columbia University in the city of New York*
*M.S Computational and data-driven engineering mechanics*
*+19173614172*
www.linkedin.com/in/sanaamouzahir
<https://www.bing.com/images/search?view=detailV2&ccid=OExL%2fKES&id=953FACCCB479C2FAA1A53CA425902FD30CA440A4&thid=OIP.OExL_KES2EC3IRZLeDK1DAHaEK&mediaurl=https%3a%2f%2fwallpapercave.com%2fwp%2fwp2710561.jpg&cdnurl=https%3a%2f%2fth.bing.com%2fth%2fid%2fR.384c4bfca112d840b721164b7832b50c%3frik%3dpECkDNMvkCWkPA%26pid%3dImgRaw%26r%3d0&exph=1080&expw=1920&q=Columbia+University&simid=608011745402298620&FORM=IRPRST&ck=6D77295D8F2F476D59DBF884FA81D9F3&selectedIndex=7&ajaxhist=0&ajaxserp=0>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.python.org/pipermail/python-win32/attachments/20220209/fa0a818a/attachment.html>


More information about the python-win32 mailing list