Sanaa Mouzahir wrote:
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?

What do you mean by "it does not work"?  Do you get an error? Does it crash?

Have you read the documentation for the SolidWorks API?  As I read the documentation, the API for running a script is called RunScript, not Run.

--
Tim Roberts, t...@probo.com
Providenza & Boekelheide, Inc.

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

_______________________________________________
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32

Reply via email to