<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Publish a drawing from VBA in VBA Forum</title>
    <link>https://forums.autodesk.com/t5/vba-forum/publish-a-drawing-from-vba/m-p/8789337#M5575</link>
    <description>&lt;P&gt;&lt;SPAN class="tlid-translation translation"&gt;&lt;SPAN class=""&gt;Show your code&lt;/SPAN&gt;&lt;/SPAN&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 14 May 2019 09:10:50 GMT</pubDate>
    <dc:creator>maratovich</dc:creator>
    <dc:date>2019-05-14T09:10:50Z</dc:date>
    <item>
      <title>Publish a drawing from VBA</title>
      <link>https://forums.autodesk.com/t5/vba-forum/publish-a-drawing-from-vba/m-p/8789154#M5574</link>
      <description>&lt;P&gt;I have written some code that fills in some paperspace table entries then I print the layout to pdf.&amp;nbsp; I then change the table entries and then publish again.&amp;nbsp; Similar to a MailMerge program.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have created a batch file .dsd and my layouts publish fine when I publish manually.&amp;nbsp; I now want vba to do the publish for me.&amp;nbsp; I will put the publish command into a loop for each pdf.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any tips please.&lt;/P&gt;</description>
      <pubDate>Tue, 14 May 2019 07:23:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/publish-a-drawing-from-vba/m-p/8789154#M5574</guid>
      <dc:creator>cve60069</dc:creator>
      <dc:date>2019-05-14T07:23:13Z</dc:date>
    </item>
    <item>
      <title>Re: Publish a drawing from VBA</title>
      <link>https://forums.autodesk.com/t5/vba-forum/publish-a-drawing-from-vba/m-p/8789337#M5575</link>
      <description>&lt;P&gt;&lt;SPAN class="tlid-translation translation"&gt;&lt;SPAN class=""&gt;Show your code&lt;/SPAN&gt;&lt;/SPAN&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 14 May 2019 09:10:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/publish-a-drawing-from-vba/m-p/8789337#M5575</guid>
      <dc:creator>maratovich</dc:creator>
      <dc:date>2019-05-14T09:10:50Z</dc:date>
    </item>
    <item>
      <title>Re: Publish a drawing from VBA</title>
      <link>https://forums.autodesk.com/t5/vba-forum/publish-a-drawing-from-vba/m-p/8789437#M5576</link>
      <description>&lt;P&gt;Option Explicit&lt;/P&gt;
&lt;P&gt;Sub DoDataSheets()&lt;/P&gt;
&lt;P&gt;' 7 May 2019. Table are being read and the invisibility states of all the objects may be changed&lt;BR /&gt;' 8 May 2019. VBA Reads all data from NAGspecification. NAGspecification re-written.&lt;BR /&gt;' Two new tables: text1 and text2&lt;BR /&gt;' 9 May 2019. Changing $ variables into text. Working&lt;BR /&gt;'10 May 2019. Template 1 updating. Text stuff needs to be proof read. Next bit is to template 2.&lt;BR /&gt;'14 May 2019. Template 2 working. Blocks have visibility states completed.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;'Declare the Global Variables&lt;BR /&gt;Const numberOfTemplates = 4&lt;BR /&gt;Const numberOfEntities = 100&lt;BR /&gt;&lt;BR /&gt;Const issueDate = "7 May 2019"&lt;BR /&gt;&lt;BR /&gt;' Declare the templates&lt;BR /&gt;Dim template As AcadLayout&lt;BR /&gt;&lt;BR /&gt;' Declare the tables&lt;BR /&gt;Dim tableArray() As AcadTable&lt;BR /&gt;ReDim tableArray(numberOfEntities)&lt;BR /&gt;&lt;BR /&gt;' Declare the blocks&lt;BR /&gt;Dim props() As AcadDynamicBlockReferenceProperty&lt;BR /&gt;Dim prop As AcadDynamicBlockReferenceProperty&lt;BR /&gt;Dim blkref As AcadBlockReference&lt;BR /&gt;&lt;BR /&gt;' Declare Entities&lt;BR /&gt;Dim entity As AcadEntity&lt;BR /&gt;&lt;BR /&gt;' Declare Index's&lt;BR /&gt;Dim tableIndex, NAGspecificationTableIndex As Integer&lt;BR /&gt;Dim loadCondition1Index, loadCondition2Index, loadCondition3Index As Integer&lt;BR /&gt;Dim technicalDataSheetIndex, safeSpanTablesIndex, propertiesIndex, certificationIndex, disclaimerIndex As Integer&lt;BR /&gt;Dim page1Index, page2Index, text1Index, text2Index As Integer&lt;BR /&gt;&lt;BR /&gt;'Locate and Assign the Tables&lt;BR /&gt;' Loop through the templates&lt;BR /&gt;tableIndex = 1&lt;BR /&gt;For Each template In ThisDrawing.Layouts&lt;BR /&gt;' Loop through each entity&lt;BR /&gt;For Each entity In template.Block&lt;BR /&gt;' Identify the table and assign to tableArray&lt;BR /&gt;If TypeOf entity Is AcadTable Then&lt;BR /&gt;'Stop&lt;BR /&gt;Set tableArray(tableIndex) = entity&lt;BR /&gt;&lt;BR /&gt;'Debug.Print tableArray(tableIndex).GetCellValue(0, 0)&lt;BR /&gt;&lt;BR /&gt;'Identify the NAGspecification table&lt;BR /&gt;If tableArray(tableIndex).GetCellValue(0, 0) = "{\C256;Technical Data Sheet}" Then technicalDataSheetIndex = tableIndex&lt;BR /&gt;If tableArray(tableIndex).GetCellValue(0, 0) = "{\C256;Safe Span Tables}" Then safeSpanTablesIndex = tableIndex&lt;BR /&gt;&lt;BR /&gt;If tableArray(tableIndex).GetCellValue(0, 0) = "{\C256;Load Condition 1}" Then loadCondition1Index = tableIndex&lt;BR /&gt;If tableArray(tableIndex).GetCellValue(0, 0) = "{\C0;Load Condition 2}" Then loadCondition2Index = tableIndex&lt;BR /&gt;If tableArray(tableIndex).GetCellValue(0, 0) = "{\C0;Load Condition 3}" Then loadCondition3Index = tableIndex&lt;BR /&gt;&lt;BR /&gt;If tableArray(tableIndex).GetCellValue(0, 0) = "{\C256;Properties}" Then propertiesIndex = tableIndex&lt;BR /&gt;If tableArray(tableIndex).GetCellValue(0, 0) = "{\C256;Certification}" Then certificationIndex = tableIndex&lt;BR /&gt;If tableArray(tableIndex).GetCellValue(0, 0) = "{\C256;Disclaimer}" Then disclaimerIndex = tableIndex&lt;BR /&gt;&lt;BR /&gt;If tableArray(tableIndex).GetCellValue(0, 2) = "Page 1" Then page1Index = tableIndex&lt;BR /&gt;If tableArray(tableIndex).GetCellValue(0, 2) = "Page 2" Then page2Index = tableIndex&lt;BR /&gt;&lt;BR /&gt;If tableArray(tableIndex).GetCellValue(0, 0) = "text1" Then text1Index = tableIndex&lt;BR /&gt;If tableArray(tableIndex).GetCellValue(0, 0) = "text2" Then text2Index = tableIndex&lt;BR /&gt;&lt;BR /&gt;If tableArray(tableIndex).GetCellValue(0, 0) = "NAGspecification" Then NAGspecificationTableIndex = tableIndex&lt;BR /&gt;&lt;BR /&gt;tableIndex = tableIndex + 1&lt;BR /&gt;End If&lt;BR /&gt;Next entity&lt;BR /&gt;Next template&lt;/P&gt;
&lt;P&gt;'Get the DataSheet values&lt;/P&gt;
&lt;P&gt;Dim productReference, textTable, blockVisibility As String&lt;BR /&gt;Dim numberProductReferences, rowIndex, i As Integer&lt;BR /&gt;&lt;BR /&gt;Dim ld1(2), ld2(2), ld3(2) As String&lt;BR /&gt;Dim lc1(2), lc2(2), lc3(2) As String&lt;BR /&gt;Dim lctxt1(2), lctxt2(2), lctxt3(2) As String&lt;BR /&gt;Dim loadtype As String&lt;BR /&gt;Dim u, light As String&lt;BR /&gt;Dim sw As Integer&lt;BR /&gt;&lt;BR /&gt;Dim d1, d2, d3, d4, d5, d6, d7 As String&lt;BR /&gt;Dim p1, p2, p3, p4, p5, p6, p7 As String&lt;BR /&gt;&lt;BR /&gt;'Stop&lt;BR /&gt;&lt;BR /&gt;numberProductReferences = tableArray(NAGspecificationTableIndex).Rows - 4&lt;BR /&gt;&lt;BR /&gt;For rowIndex = 4 To numberProductReferences + 3&lt;BR /&gt;&lt;BR /&gt;With tableArray(NAGspecificationTableIndex)&lt;BR /&gt;&lt;BR /&gt;' Stop&lt;BR /&gt;productReference = .GetCellValue(rowIndex, 0)&lt;BR /&gt;loadtype = .GetCellValue(rowIndex, 1)&lt;BR /&gt;&lt;BR /&gt;If loadtype = 1 Then&lt;BR /&gt;&lt;BR /&gt;lctxt1(0) = "Domestic and Residential Activities"&lt;BR /&gt;lctxt1(1) = "All usage within self-contained dwelling units including student-accommodation, blocks of flats, dormitories, hotels, motels, hospitals, public-toilets, snooker-rooms, balconies., flat-roofs and walkways. Not suitable for where people may congregate."&lt;BR /&gt;&lt;BR /&gt;lctxt2(0) = "Communal Areas"&lt;BR /&gt;lctxt2(1) = "Areas where people may congregate including restaurants, reading-rooms, classrooms, fixed seating areas, corridors, museums, dance floors, concert halls and public areas subject to crowding."&lt;BR /&gt;&lt;BR /&gt;lctxt3(0) = "Highway Use"&lt;BR /&gt;lctxt3(1) = "Pavement-lights situated close to a road or access where heavy vehicles could park on the pavement-light. Inner London requirement."&lt;BR /&gt;&lt;BR /&gt;lc1(0) = .GetCellValue(rowIndex, 4): lc1(1) = .GetCellValue(rowIndex, 5)&lt;BR /&gt;lc2(0) = .GetCellValue(rowIndex, 6): lc2(1) = .GetCellValue(rowIndex, 7)&lt;BR /&gt;lc3(0) = .GetCellValue(rowIndex, 8): lc3(1) = .GetCellValue(rowIndex, 9)&lt;BR /&gt;&lt;BR /&gt;ld1(0) = .GetCellValue(3, 4): ld1(1) = .GetCellValue(3, 5)&lt;BR /&gt;ld2(0) = .GetCellValue(3, 6): ld2(1) = .GetCellValue(3, 7)&lt;BR /&gt;ld3(0) = .GetCellValue(3, 8): ld1(1) = .GetCellValue(3, 9)&lt;BR /&gt;&lt;BR /&gt;End If&lt;BR /&gt;&lt;BR /&gt;If loadtype = 2 Then&lt;BR /&gt;&lt;BR /&gt;lctxt1(0) = "Rooflights and Domestic Use"&lt;BR /&gt;lctxt1(1) = "."&lt;BR /&gt;&lt;BR /&gt;lctxt2(0) = "Domestic and Residential Activities"&lt;BR /&gt;lctxt2(1) = "All usage within self-contained dwelling units including student-accommodation, blocks of flats, dormitories, hotels, motels, hospitals, public-toilets, snooker-rooms, balconies., flat-roofs and walkways. Not suitable for where people may congregate."&lt;BR /&gt;&lt;BR /&gt;lctxt3(0) = "Communal Areas"&lt;BR /&gt;lctxt3(1) = "Areas where people may congregate including communal restaurants, reading-rooms, classrooms, fixed seating areas, assembly areas, corridors, museums, dance floors, concert halls and public areas subject to crowding."&lt;BR /&gt;&lt;BR /&gt;lc1(0) = .GetCellValue(rowIndex, 2): lc1(1) = .GetCellValue(rowIndex, 3)&lt;BR /&gt;lc2(0) = .GetCellValue(rowIndex, 4): lc2(1) = .GetCellValue(rowIndex, 5)&lt;BR /&gt;lc3(0) = .GetCellValue(rowIndex, 6): lc3(1) = .GetCellValue(rowIndex, 7)&lt;BR /&gt;&lt;BR /&gt;ld1(0) = .GetCellValue(3, 4): ld1(1) = .GetCellValue(3, 5)&lt;BR /&gt;ld2(0) = .GetCellValue(3, 6): ld2(1) = .GetCellValue(3, 7)&lt;BR /&gt;ld3(0) = .GetCellValue(3, 8): ld1(1) = .GetCellValue(3, 9)&lt;BR /&gt;&lt;BR /&gt;End If&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;textTable = .GetCellValue(rowIndex, 10)&lt;BR /&gt;blockVisibility = .GetCellValue(rowIndex, 11)&lt;BR /&gt;&lt;BR /&gt;d1 = productReference&lt;BR /&gt;d2 = .GetCellValue(rowIndex, 12)&lt;BR /&gt;d3 = .GetCellValue(rowIndex, 13)&lt;BR /&gt;d4 = .GetCellValue(rowIndex, 14)&lt;BR /&gt;d5 = .GetCellValue(rowIndex, 15)&lt;BR /&gt;d6 = .GetCellValue(rowIndex, 16)&lt;BR /&gt;d7 = .GetCellValue(rowIndex, 17)&lt;BR /&gt;&lt;BR /&gt;u = .GetCellValue(rowIndex, 18)&lt;BR /&gt;sw = .GetCellValue(rowIndex, 19)&lt;BR /&gt;light = .GetCellValue(rowIndex, 20)&lt;BR /&gt;'Stop&lt;BR /&gt;End With ' tableArray(NAGspecificationTableIndex)&lt;BR /&gt;&lt;BR /&gt;'Time to get the text box values&lt;BR /&gt;&lt;BR /&gt;If textTable = "text1" Then&lt;BR /&gt;&lt;BR /&gt;With tableArray(text1Index)&lt;/P&gt;
&lt;P&gt;p1 = DoDollar(.GetCellValue(2, 1), d1, d2, d3, d4, d5, d6, d7)&lt;BR /&gt;p2 = DoDollar(.GetCellValue(2, 2), d1, d2, d3, d4, d5, d6, d7)&lt;BR /&gt;p3 = DoDollar(.GetCellValue(2, 3), d1, d2, d3, d4, d5, d6, d7)&lt;BR /&gt;p4 = DoDollar(.GetCellValue(3, 1), d1, d2, d3, d4, d5, d6, d7)&lt;BR /&gt;p5 = DoDollar(.GetCellValue(4, 1), d1, d2, d3, d4, d5, d6, d7)&lt;BR /&gt;p6 = DoDollar(.GetCellValue(4, 2), d1, d2, d3, d4, d5, d6, d7)&lt;BR /&gt;&lt;BR /&gt;' Do again for included $'s&lt;BR /&gt;&lt;BR /&gt;p1 = DoDollar(p1, d1, d2, d3, d4, d5, d6, d7)&lt;BR /&gt;p2 = DoDollar(p2, d1, d2, d3, d4, d5, d6, d7)&lt;BR /&gt;p3 = DoDollar(p3, d1, d2, d3, d4, d5, d6, d7)&lt;BR /&gt;p4 = DoDollar(p4, d1, d2, d3, d4, d5, d6, d7)&lt;BR /&gt;p5 = DoDollar(p5, d1, d2, d3, d4, d5, d6, d7)&lt;BR /&gt;p6 = DoDollar(p6, d1, d2, d3, d4, d5, d6, d7)&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;End With 'tableArray(text1Index)&lt;BR /&gt;&lt;BR /&gt;End If 'textTable = "text1"&lt;BR /&gt;&lt;BR /&gt;If textTable = "text2" Then&lt;BR /&gt;&lt;BR /&gt;With tableArray(text2Index)&lt;BR /&gt;&lt;BR /&gt;p1 = DoDollar(.GetCellValue(2, 1), d1, d2, d3, d4, d5, d6, d7)&lt;BR /&gt;p2 = DoDollar(.GetCellValue(2, 2), d1, d2, d3, d4, d5, d6, d7)&lt;BR /&gt;p3 = DoDollar(.GetCellValue(2, 3), d1, d2, d3, d4, d5, d6, d7)&lt;BR /&gt;p4 = DoDollar(.GetCellValue(3, 1), d1, d2, d3, d4, d5, d6, d7)&lt;BR /&gt;p5 = DoDollar(.GetCellValue(4, 1), d1, d2, d3, d4, d5, d6, d7)&lt;BR /&gt;p6 = DoDollar(.GetCellValue(4, 2), d1, d2, d3, d4, d5, d6, d7)&lt;BR /&gt;&lt;BR /&gt;' Do again for included $'s&lt;BR /&gt;&lt;BR /&gt;p1 = DoDollar(p1, d1, d2, d3, d4, d5, d6, d7)&lt;BR /&gt;p2 = DoDollar(p2, d1, d2, d3, d4, d5, d6, d7)&lt;BR /&gt;p3 = DoDollar(p3, d1, d2, d3, d4, d5, d6, d7)&lt;BR /&gt;p4 = DoDollar(p4, d1, d2, d3, d4, d5, d6, d7)&lt;BR /&gt;p5 = DoDollar(p5, d1, d2, d3, d4, d5, d6, d7)&lt;BR /&gt;p6 = DoDollar(p6, d1, d2, d3, d4, d5, d6, d7)&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;End With 'tableArray(text2Index)&lt;BR /&gt;&lt;BR /&gt;End If 'textTable = "text2"&lt;BR /&gt;&lt;BR /&gt;'Write to Templates&lt;BR /&gt;&lt;BR /&gt;'Set the Product Reference&lt;BR /&gt;&lt;BR /&gt;With tableArray(technicalDataSheetIndex)&lt;BR /&gt;&lt;BR /&gt;Call .SetValue(0, 1, 0, d1)&lt;BR /&gt;&lt;BR /&gt;Call .SetValue(3, 0, 0, p1)&lt;BR /&gt;Call .SetValue(3, 1, 0, p2)&lt;BR /&gt;Call .SetValue(3, 2, 0, p3)&lt;BR /&gt;&lt;BR /&gt;End With&lt;BR /&gt;&lt;BR /&gt;Call tableArray(safeSpanTablesIndex).SetValue(1, 0, 0, p4)&lt;BR /&gt;&lt;BR /&gt;With tableArray(loadCondition1Index)&lt;BR /&gt;&lt;BR /&gt;Call .SetValue(0, 3, 0, lctxt1(0))&lt;BR /&gt;Call .SetValue(1, 0, 0, lctxt1(1))&lt;BR /&gt;&lt;BR /&gt;Call .SetValue(3, 0, 0, ld1(0))&lt;BR /&gt;Call .SetValue(3, 1, 0, ld1(1))&lt;BR /&gt;Call .SetValue(3, 2, 0, lc1(0) &amp;amp; " mm")&lt;BR /&gt;Call .SetValue(3, 3, 0, lc1(1) &amp;amp; " mm")&lt;BR /&gt;&lt;BR /&gt;End With&lt;BR /&gt;&lt;BR /&gt;With tableArray(loadCondition2Index)&lt;BR /&gt;&lt;BR /&gt;Call .SetValue(0, 3, 0, lctxt2(0))&lt;BR /&gt;Call .SetValue(1, 0, 0, lctxt2(1))&lt;BR /&gt;&lt;BR /&gt;Call .SetValue(3, 0, 0, ld2(0))&lt;BR /&gt;Call .SetValue(3, 1, 0, ld2(1))&lt;BR /&gt;Call .SetValue(3, 2, 0, lc2(0) &amp;amp; " mm")&lt;BR /&gt;Call .SetValue(3, 3, 0, lc2(1) &amp;amp; " mm")&lt;BR /&gt;&lt;BR /&gt;End With&lt;BR /&gt;&lt;BR /&gt;With tableArray(loadCondition3Index)&lt;BR /&gt;&lt;BR /&gt;Call .SetValue(0, 3, 0, lctxt3(0))&lt;BR /&gt;Call .SetValue(1, 0, 0, lctxt3(1))&lt;BR /&gt;&lt;BR /&gt;Call .SetValue(3, 0, 0, ld2(0))&lt;BR /&gt;Call .SetValue(3, 1, 0, ld2(1))&lt;BR /&gt;Call .SetValue(3, 2, 0, lc2(0) &amp;amp; " mm")&lt;BR /&gt;Call .SetValue(3, 3, 0, lc2(1) &amp;amp; " mm")&lt;BR /&gt;&lt;BR /&gt;End With&lt;BR /&gt;&lt;BR /&gt;With tableArray(propertiesIndex)&lt;BR /&gt;&lt;BR /&gt;Call .SetValue(1, 1, 0, p5)&lt;BR /&gt;Call .SetValue(1, 2, 0, p6)&lt;BR /&gt;&lt;BR /&gt;Call .SetValue(2, 1, 0, uValue(u))&lt;BR /&gt;Call .SetValue(3, 1, 0, selfWeight(sw))&lt;BR /&gt;Call .SetValue(4, 1, 0, lightTransmittance(light))&lt;BR /&gt;&lt;BR /&gt;End With&lt;BR /&gt;&lt;BR /&gt;'Locate and Assign the Block visibilities&lt;BR /&gt;' Loop through the templates&lt;BR /&gt;For Each template In ThisDrawing.Layouts&lt;BR /&gt;' Loop through each entity&lt;BR /&gt;For Each entity In template.Block&lt;BR /&gt;' Identify the block visibility and assign the visibility value&lt;BR /&gt;If TypeOf entity Is AcadBlockReference Then&lt;BR /&gt;Set blkref = entity&lt;BR /&gt;If blkref.IsDynamicBlock Then&lt;BR /&gt;props = blkref.GetDynamicBlockProperties&lt;BR /&gt;For i = 0 To UBound(props)&lt;BR /&gt;Set prop = props(i)&lt;BR /&gt;'Debug.Print prop.PropertyName&lt;BR /&gt;If prop.PropertyName = "Visibility1" Then&lt;BR /&gt;prop.Value = blockVisibility&lt;BR /&gt;End If&lt;BR /&gt;If prop.PropertyName = "Plans" Then&lt;BR /&gt;prop.Value = productReference&lt;BR /&gt;End If&lt;BR /&gt;Next i&lt;BR /&gt;End If&lt;BR /&gt;End If&lt;BR /&gt;Next entity&lt;BR /&gt;Next template&lt;BR /&gt;&lt;BR /&gt;ThisDrawing.Application.Update&lt;/P&gt;
&lt;P&gt;Next rowIndex&lt;BR /&gt;&lt;BR /&gt;Stop&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;MsgBox "Done"&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;'&lt;/P&gt;
&lt;P&gt;End Sub&lt;BR /&gt;Function DoColon(txt As String) As String&lt;BR /&gt;'Stop&lt;BR /&gt;Dim strLen, i As Integer&lt;BR /&gt;strLen = Len(txt)&lt;BR /&gt;For i = 1 To strLen&lt;BR /&gt;' Find the semi-colon&lt;BR /&gt;If Mid(txt, i, 1) = ";" Then&lt;BR /&gt;DoColon = Right(txt, strLen - i)&lt;BR /&gt;Exit For&lt;BR /&gt;End If&lt;BR /&gt;Next i&lt;BR /&gt;End Function&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Function DoDollar(txt, d1, d2, d3, d4, d5, d6, d7) As String 'txt, d1, d2, d3, d4, d5, d6 As String) As String&lt;/P&gt;
&lt;P&gt;txt = Replace(txt, "$1", d1)&lt;BR /&gt;txt = Replace(txt, "$2", d2)&lt;BR /&gt;txt = Replace(txt, "$3", d3)&lt;BR /&gt;txt = Replace(txt, "$4", d4)&lt;BR /&gt;txt = Replace(txt, "$5", d5)&lt;BR /&gt;txt = Replace(txt, "$6", d6)&lt;BR /&gt;txt = Replace(txt, "$7", d7)&lt;BR /&gt;DoDollar = txt&lt;BR /&gt;'Debug.Print DoDollar&lt;BR /&gt;'Stop&lt;BR /&gt;End Function&lt;BR /&gt;Function selfWeight(n) As String&lt;/P&gt;
&lt;P&gt;selfWeight = Format(CStr(n * 0.981), "000.0") &amp;amp; " kN/sq.m" &amp;amp; " (" &amp;amp; CStr(n) &amp;amp; " kg/sq.m )"&lt;BR /&gt;&lt;BR /&gt;End Function&lt;/P&gt;
&lt;P&gt;Function uValue(n) As String&lt;/P&gt;
&lt;P&gt;uValue = n &amp;amp; " W/sq.m.K"&lt;BR /&gt;&lt;BR /&gt;End Function&lt;/P&gt;
&lt;P&gt;Function lightTransmittance(n) As String&lt;/P&gt;
&lt;P&gt;If n = "N/A" Then lightTransmittance = n Else lightTransmittance = n &amp;amp; " %"&lt;/P&gt;
&lt;P&gt;End Function&lt;/P&gt;</description>
      <pubDate>Tue, 14 May 2019 10:07:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/publish-a-drawing-from-vba/m-p/8789437#M5576</guid>
      <dc:creator>cve60069</dc:creator>
      <dc:date>2019-05-14T10:07:23Z</dc:date>
    </item>
    <item>
      <title>Re: Publish a drawing from VBA</title>
      <link>https://forums.autodesk.com/t5/vba-forum/publish-a-drawing-from-vba/m-p/8789584#M5577</link>
      <description>&lt;P&gt;The key I am looking for is in this line&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;:..use sendcommand in VBA to run the -PUBLISH command with the DSD-file as a parameter.."&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;which I filtched from another question.&lt;/P&gt;</description>
      <pubDate>Tue, 14 May 2019 11:14:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/publish-a-drawing-from-vba/m-p/8789584#M5577</guid>
      <dc:creator>cve60069</dc:creator>
      <dc:date>2019-05-14T11:14:28Z</dc:date>
    </item>
    <item>
      <title>Re: Publish a drawing from VBA</title>
      <link>https://forums.autodesk.com/t5/vba-forum/publish-a-drawing-from-vba/m-p/8801578#M5578</link>
      <description>&lt;P&gt;As PUBLISH works in the background, it is not possible to pass VBA code directly to the Publisher.&amp;nbsp; To get around this, it is necessary to set the parameters to PUBLISH from the command line. "NAGspecification" is the name of the dsd file. I plagiarised this code from Mike Tuersley off the internet (thanks Mike).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ThisDrawing.SendCommand "(command " &amp;amp; _&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Chr(34) &amp;amp; "-PUBLISH" &amp;amp; Chr(34) &amp;amp; _&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; " " &amp;amp; Chr(34) &amp;amp; "NAGspecification" &amp;amp; _&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Chr(34) &amp;amp; ")" &amp;amp; vbCr&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The PUBLISH process takes time so necessary to delay the printing.&amp;nbsp; This depends on the size of the print.&amp;nbsp; I ran a print and checked the plot log for the print time and 50 worked for me.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;' Pause for PDF publish&lt;BR /&gt;&amp;nbsp; &amp;nbsp;For i = 1 To 50&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; DoEvents ' Yield to other processes.&lt;BR /&gt;&amp;nbsp; Next i&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want to plot a number of drawings, changing details on each page before plotting.&amp;nbsp; To set the name of the pdf I used vba to edit the NAGspecification.dsd file. I opened the dsd file and then read its contents into a string variable and then renamed the output pdf and then saved the dsd file onto itself.&amp;nbsp; By placing this in a loop, I managed to print 18 pdf's changing the details in each.&amp;nbsp; I created the NAGspecification.dsd file&amp;nbsp; from Print&amp;gt;Batch Plot.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A summary of my final code is..&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ThisDrawing.SetVariable "FILEDIA", 0 'Shut down dialog boxes&lt;/P&gt;
&lt;P&gt;Dim tableArray() As AcadTable 'This is my productReference table&lt;/P&gt;
&lt;P&gt;Dim pth As String :&amp;nbsp;pth = "C:\NAGspecification.dsd"&lt;/P&gt;
&lt;P&gt;Dim oldName, newName As String :&amp;nbsp;oldName = "NAGspecification.pdf" ' This is name in the saved dsd file.&lt;/P&gt;
&lt;P&gt;Dim strline, totalFile As String 'Variables used to manipulate the dsd file&lt;/P&gt;
&lt;P&gt;Dim numberProductReferences&amp;nbsp; as Integer :&amp;nbsp;numberProductReferences = tableArray(technicalIndex).Rows - 3&lt;/P&gt;
&lt;P&gt;rowIndex = 3 ' This is the row in my table of productReferences&lt;/P&gt;
&lt;P&gt;Do&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;productReference =&amp;nbsp;tableArray(technicalIndex).GetCellValue(rowIndex, 0) 'Look up productReference&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;'Do all necessary changes to the layouts I want to plot&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;'Copy dsd into total file&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;Open pth For Input As #1&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;While EOF(1) = False&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; Line Input #1, strline&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; totalFile = totalFile + strline + vbNewLine&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;Wend&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;Close #1&lt;/P&gt;
&lt;P&gt;newName = productReference + ".pdf" 'Set the old name to the new name&lt;BR /&gt;totalFile = Replace(totalFile, oldName, newName) 'Change the name of the pdf in the dsd file&lt;/P&gt;
&lt;P&gt;Open pth For Output As #1&lt;BR /&gt;&amp;nbsp; &amp;nbsp;Print #1, totalFile 'Then save the dsd file over itself&lt;BR /&gt;Close #1&lt;/P&gt;
&lt;P&gt;'Activate PUBLISH&lt;/P&gt;
&lt;P&gt;ThisDrawing.SendCommand "(command " &amp;amp; Chr(34) &amp;amp; _&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "-PUBLISH" &amp;amp; Chr(34) &amp;amp; " " &amp;amp; Chr(34) &amp;amp; _&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;"NAGspecification" &amp;amp; Chr(34) &amp;amp; ")" &amp;amp; vbCr&lt;/P&gt;
&lt;P&gt;' Pause for PDF publish&lt;BR /&gt;&amp;nbsp; &amp;nbsp;For i = 1 To 50&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; DoEvents ' Yield to other processes.&lt;BR /&gt;&amp;nbsp; &amp;nbsp;Next i&lt;BR /&gt;&amp;nbsp; &amp;nbsp;oldName = newName ' Update the reference list&lt;BR /&gt;rowIndex = rowIndex + 1 'Update the loop&lt;BR /&gt;&lt;BR /&gt;Loop Until rowIndex = numberProductReferences + 3 'Start again until all references are printed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;'Tidy up and Reset the dsd file to its original settings&lt;BR /&gt;&amp;nbsp; &amp;nbsp;totalFile = Replace(totalFile, oldName, "NAGspecification.pdf")&lt;BR /&gt;Open pth For Output As #1&lt;BR /&gt;Print #1, totalFile&lt;BR /&gt;Close #1&lt;BR /&gt;ThisDrawing.SetVariable "FILEDIA", 1 'Turn back on dialogs&lt;/P&gt;
&lt;P&gt;msgbox "Done"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks to all those that gave me hints along the way.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 20 May 2019 10:13:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/publish-a-drawing-from-vba/m-p/8801578#M5578</guid>
      <dc:creator>cve60069</dc:creator>
      <dc:date>2019-05-20T10:13:46Z</dc:date>
    </item>
    <item>
      <title>Re: Publish a drawing from VBA</title>
      <link>https://forums.autodesk.com/t5/vba-forum/publish-a-drawing-from-vba/m-p/8809978#M5579</link>
      <description>&lt;P&gt;Hi, I dont understand your request. While wait who give u a suggest use my lisp. Hope help you.&lt;/P&gt;&lt;P&gt;In my lisp had "Command Printer" quick plot all drawings Model and Layout, with multiple&amp;nbsp; select for you.&lt;/P&gt;&lt;P&gt;&lt;A href="https://forums.autodesk.com/t5/visual-basic-customization/i-m-sharing-my-useful-autolisp-collection/td-p/8809161" target="_blank" rel="noopener"&gt;https://forums.autodesk.com/t5/visual-basic-customization/i-m-sharing-my-useful-autolisp-collection/td-p/8809161&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 23 May 2019 11:30:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/publish-a-drawing-from-vba/m-p/8809978#M5579</guid>
      <dc:creator>Ben_MBA</dc:creator>
      <dc:date>2019-05-23T11:30:24Z</dc:date>
    </item>
  </channel>
</rss>

