Use sendcommand in VBA to run the -PUBLISH command with the DSD-file

Use sendcommand in VBA to run the -PUBLISH command with the DSD-file

cve60069
Advocate Advocate
3,958 Views
9 Replies
Message 1 of 10

Use sendcommand in VBA to run the -PUBLISH command with the DSD-file

cve60069
Advocate
Advocate

I want to publish two layouts using VBA and I have had some success with the following code

 

ThisDrawing.SendCommand "-PUBLISH" & vbCr.

 

which I filched from another forum question: i.e. ".. you can use sendcommand in VBA to run the -PUBLISH command with the DSD-file as a parameter..."

 

When I run the VBA, I am prompted for the dsd file which is "NAGspecification.dsd" which has two layouts "Template 1 and Template 2" which I want to publish into a multiple sheets set.

 

How do I pass the parameters please?

 

 

0 Likes
Accepted solutions (1)
3,959 Views
9 Replies
Replies (9)
Message 2 of 10

cve60069
Advocate
Advocate
Accepted solution

Set up the Publish Printer in Print>Batch Plot>Publish Options>Multi Sheet File

 

Add ThisDrawing.SendCommand "-PUBLISH" "NAGspecification.dsd" & vbCr to the code.

 

And it works.

 

Not sure if I am able to answer my own question but it is solved.

 

0 Likes
Message 3 of 10

cve60069
Advocate
Advocate

My last solution did not work. Not sure why it did but the correct solution is below.

 

ThisDrawing.SetVariable "FILEDIA", 0 'Stop dialog boxes

 

ThisDrawing.SendCommand "(command " & Chr(34) & _
"-PUBLISH" & Chr(34) & _
" " & Chr(34) & "NAGspecification" & _
Chr(34) & ")" & vbCr

 

ThisDrawing.SetVariable "FILEDIA", 1 'Reset dialog boxes

Author for this was  Mike Tuersley

Message 4 of 10

Anonymous
Not applicable
Can you please share that .dsd file?
0 Likes
Message 5 of 10

cve60069
Advocate
Advocate
You need to create a DSD file yourself. How to create the DSD file and edit. 1. create the layouts that need to be published. To do this 2. select the layouts and right-click and publish. 3. you will be asked to save the layout set to a DSD file. Say yes and save. 4. The DSD file is a text file. Locate the DSD file on the hard-drive. 5. Using VBA, open the DSD file and read its contents into an array. 6. Manipulate the text as you want. I changed the names of the layouts to be published. 7. Save the DSD file onto itself. 8. Publish the layouts.
0 Likes
Message 6 of 10

Anonymous
Not applicable

I have my DSD file stored at "C:\Users\Documents\AutoCAD Sheet Sets\PublishData.dsd" this location. I just need help to write the VBA code to run this DSD file by giving "Publish" command.

0 Likes
Message 7 of 10

cve60069
Advocate
Advocate

ThisDrawing.SendCommand "(command " & Chr(34) & "-PUBLISH" & Chr(34) & " " & Chr(34) & "YourFilename" & Chr(34) & ")" & vbCr

' Pause for PDF publish
For i = 1 To 50
DoEvents ' Yield to other processes.
Next

0 Likes
Message 8 of 10

Anonymous
Not applicable
Thank for this, but this is not working. Not pdf file is getting generated.
0 Likes
Message 9 of 10

Anonymous
Not applicable

The above given code is just opening the dialog box but not selecting the DSD file (provided in code) automatically. It get stuck at the dialog box only. Please give the solution for this

 

0 Likes
Message 10 of 10

cve60069
Advocate
Advocate

eshwarmhase5

 

I am not an expert but I will try to help.  I have written a code that allows me to dynamically publish pdf's from a table and it works so I might be able to assist.

 

Are you able to show me your code.

0 Likes