×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Visual Basic/SolidWorks running a SW macro from VB

Visual Basic/SolidWorks running a SW macro from VB

Visual Basic/SolidWorks running a SW macro from VB

(OP)
I would like to run a SolidWorks macro from VB.  Does anyone have an example?  The drawing I want to modify is already running and the macro is saved in app.path.  When
I try to implement the macro within VB it does not work.  I just need a way to call it from VB.

Thanks,
Josh

RE: Visual Basic/SolidWorks running a SW macro from VB

(OP)
NEVERMIND

Thanks

Josh

RE: Visual Basic/SolidWorks running a SW macro from VB

Nevermind? Did you find a way to implement this? Or are you just trying it a different way?

RE: Visual Basic/SolidWorks running a SW macro from VB

(OP)
rocheey

At first I was unable to run the code from my visual basic program, but I made some modifications so it would run
in the program and not just in the SolidWorks API environment.

Thanks

Josh

RE: Visual Basic/SolidWorks running a SW macro from VB

(OP)
But if anyone could give a sample on running a SW macro from VB I would still appreciate it.

Thanks

Josh

RE: Visual Basic/SolidWorks running a SW macro from VB

' I put this code in: "C:\Program Files\SolidWorks\Macros\" and call it: "TitleBlock.swb" Then I set a macro key to Ctrl F12. The VB program called "Titleblock.exe" will run.

Dim swApp As Object
Dim Part As Object
Dim Gtol As Object
Dim FeatureData As Object
Dim Feature As Object
Dim Component As Object
Sub main()
    ' Start the application and activate it
     MyAppID = Shell("J:\@Engineering Central\Common\Applications\SolidWorks\Executables\Titleblock.exe", 1)
End Sub

Bradley

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources