Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations MintJulep on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

SW API macro runs in background

Status
Not open for further replies.

DesignModeler

Mechanical
May 17, 2011
23
I'm sure this topic has been covered, but I've had no luck finding related threads. Most of my macro prompts get lost in the background of Windows 7 and I have to hit Alt-Tab to switch it over and it is starting to get a bit annoying. Is there any easy way to set them to come up in the foreground immediately? Could someone point me to the corresponding thread if it exists? I've solved it before but I used a really ugly collection of functions and modules that didn't seem too efficient. Thanks for your help.
 
Replies continue below

Recommended for you

Macro does not contain any userforms, just msgboxs... will it work nonetheless?
 
Sorry, I should've been more specific: MY macro doesn't include any userforms, only msgboxs. ill try these ideas though, thanks.
 
I don't need or want a userform.


Sub main()

Dim Question as Long

Question = msgbox("Does this come up first?", vbYesNo)

If Question = vbYes Then
msgbox "You obviously don't need to do this.", vbOkayOnly
Else
msgbox "More help is needed.", vbOkayOnly
End if

End Sub


Obviously if you run this on W7x64 SW2011 SP3.0 - all msgboxs will remain hidden. Is there anyone that has changed system options or possibly vb add-in library references to achieve this result?
 
What if you use SldWorks.SendMsgToUser2 instead of MsgBox?

If I'm not mistaken, those windows originate in SolidWorks, as opposed to Windows. Plus, if it does work, it gives you quite a few options as far as the buttons on the message box...
 
There are a couple work-arounds you can do.

One would be to use a form and use the code to change the text shown on the form with the code from Lorono's site.

I did read about another method than message boxes while researching the code to write what I posted at Lorono's.

What gopack13 posted should work as well as long as you're running from Solidworks.

James Spisich
Design Engineer, CSWP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor