Macro pdf save as

Hi all

I'm looking for a slightly advanced macro of the recording of a . SLDDRW to PDF with the following steps:

-Retrieve the solidworks properties for the file name + plan revision + sheet name + .. PDF

- open the "save as" window of SW with the name of the file already filled in

-that this window opens automatically on the desired volume/folder (K:\doc\   in this case, then I still have to manually select a folder that varies)

- with a loop to make a different record for each sheet of my . SLDDRW in .PDF

 

I'm putting two screenshots to make it a little clearer, I'm not sure that all this is possible....

 

In any case, thank you for any help you will give me.


titre_fichier.jpg

In the MyCad tools (which you can have)  you should find what you are looking for with Integration, it allows you to save in pdf by retrieving different properties and establishing several rules.

Possibility to save a MEP in a different format, to export each sheet in 1 same file or not.

Rename a file with properties.

Possibly complete a property based on an excel file...

The possibilities are very vast and accessible without any knowledge of macro.

2 Likes

Hello

Subject covered many times: http://www.lynkoa.com/search/macro%20pdf?type[0]=question

Start by reading these many threads and then come back to us.

Have a nice day

4 Likes

I already have a macro processing that I do previously and that I would integrate before into the future macro, so that my macro will do everything at once.

 

I've already looked and downloaded a lot of subject and macro on this with example macro

 

I've already tinkered with one but I can't finalize, the save as window is not the right one, my file name is the same as the name of my original file, it's not what I would like.

 

I'd rather use a macro than rather Integration, I have several people who don't know about integration who will use it next.

 

I need a VB ace on SW...

Hello

This kind of macro requires a little time for development and development. As for the use of the save as window of SW it is not necessarily the most practical because its control via the APIs is not optimal if my memory is correct.

Hello, @Cyril, you say that the "save as..." "  is not the most practical!?

What are you thinking of when you say that???

Cdt

G.M

Control of the object if someone clicks on cancel and retrieve the record name. The easiest way to my knowledge is to open a basic explorer window to select a path, retrieve it as a parameter and manage the record (formatting the name...) directly via the macro code.

1 Like

Hello

See if the attached macro suits you, the code remains to be secured with error handling....

If you insert this code in another macro, be sure not to forget to add the reference "Microsoft Shell Controls And Automation" to be able to use the "BrowseForFolder" to select the destination folder of the PDFs.

Kind regards


macro_pdf_enregistrer_sous.swp

Hello

 

Thank you d.roger your macro is really not bad. In the meantime I found another function where I pre-filled the destination path:

Function BrowseFolder(Optional Caption As String, _
    Optional InitialFolder As String) As String

Dim SH As Shell32.Shell
Dim F As Shell32.Folder

Set SH = New Shell32.Shell
'Set F = SH. BrowseForFolder(0&, Caption, BIF_RETURNONLYFSDIRS, InitialFolder)
Set F = SH. BrowseForFolder(0&, Caption, BIF_RETURNONLYFSDIRS, "K:\Doc\" & Nummach)

If Not F Is Nothing Then
    BrowseFolder = F.Items.Item.Path
End If

End Function

 

Thank you all for your help