API Question : Status Bar when a document is being saved

Mar 22, 2007 4 Replies

I have a macro that saves PDF files to a specified user directory. When you save a PDF file in SolidWorks, it sometimes takes 2-3 seconds. The screen may turn white where a message box was, and it looks like nothing is happening. Is it possible to display a message box stating "PDF is being saved", then remove the message box when the save operation is complete?



Here is my code to save the PDF



Save: bRet = swDrawing.SaveAs4(FileSave, swSaveAsCurrentVersion, swSaveAsOptions_Silent, swReadOnlySaveError, nWarnings) If bRet = False Then GoTo ErrorMsg End If



SW Monkey,

There isn't any message boxes for any other types of saves. Why is one needed for PDF?

To answer the question, you use a form in your macro and have it display whatever messages you want.

Matt

formatting link

fcsuper,

I tried using a form. ( formname.show ) , but when the form pops up, the rest of the macro doesn't run unless I close the form.

This is what I would like. MACRO CODE FORM POPUP CONTINUE MACRO CODE FORM CLOSES MACRO CODE ENDS

SW Monkey,

Perhaps this configuration?: MACRO CODE FORM POPUP FORM HAS FUNCTIONS ASSIGNED TO COMMAND BUTTONS WHICH PREFORM THE DESIRED TASKS FORM IS CLOSED AT USER'S CONVENIENCE MACRO CODE CLEANS HOUSE AND ENDS

Under the SAVE command button you can have a preliminary change to a label that says "Saving to PDF", then have the save code, then an error handler that will display the results to the label once the save is complete (with some IF THEN's that use the error variables you've used in the save code). Mind you, this is all for show since the VBA isn't directly talking to any PDF status report, but it shows a status that which you require.

Matt

formatting link

*ahem...* Have you ever looked at the mighty SolidWorks API help?

Hint: You could, for example, search for status bar. Another hint: you could write your status text to the status bar and clear the text when you are finished. No need to hassle with clumsy message boxes.

-h-

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required