VBA: Deleting Error Messages/Warnings

Hello

I have a little problem with my macro, it's that it displays all the error/warning messages when I save my shots. I would like to skip the error messages, any advice?

The macro bit that records and that I use is the next one:

Part.Extension.SaveAs pdfPathName, 0, 0, swExportPDFData, lErrors, lWarnings
Thanks in advance!

Hello

For PDF.swp printing (23 KB)

I'm attaching the macro we use to make PDFs

Tell me again if it helped you

Centor

1 Like

Hello and thank you,

But unfortunately the messages of different scales are still present :frowning:

Re

Uh, from what I know, the release in PDF loses the scale according to what we saw at home

On the other hand, in DXF you can keep it
Enregistre_DXF_echel_1-1.swp (34 KB)

You will just have to rename the path where you want to drop it

@dustin.cornu please attach the full code if possible to help you as best as possible.
And also a screen print of the window that is displayed.

1 Like

DC - 2.swp ( 65.5 KB)

Hello

Here's the full code. This is a mill that will open the plans of all the parts and sub-assemblies of ALL ACTIVE assemblies (1 by 1) and save them in PDF and DXF under the file name + small modification (addition of the index in the middle of the designation).

It is not optimal in terms of construction but works ^^! I'll take it back when I've fixed the problem of the = dialog boxes>

It works very well except for the dialog box that bothers me because I have to stay in front of the PC to confirm each time

Thanks in advance

Ok I understand better with the window^tre.
It seems to me that we should add the Silent option:
https://help.solidworks.com/2017/English/api/sldworksapi/SolidWorks.Interop.sldworks~SolidWorks.Interop.sldworks.IModelDocExtension~SaveAs.html
The link to the option:
https://help.solidworks.com/2017/English/api/swconst/SOLIDWORKS.Interop.swconst~SOLIDWORKS.Interop.swconst.swSaveAsOptions_e.html
And an example in step but it doesn't change the principle:
https://help.solidworks.com/2017/English/api/sldworksapi/Import_STEP_File_Example_VB.htm

3 Likes

Hello;

I'm using the " SaveAs2 " function for a relatively similar macro:

value = instance. SaveAs2(NewName, SaveAsVersion, SaveAsCopy, Silent)

SaveAs2 Method (IModelDoc2) body {visibility: hidden}

therefore...
Part.SaveAs2 NewFilePath & ".  DWG ", 0, True, False
and
Part.SaveAs2 NewFilePath & " .PDF ", 0, True, False

I will add that my settings for the "Save as: DWG" options are:
image

Kind regards.

2 Likes

It works ^^! Thank you very much <3 I didn't know about this option!!