<?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 Batch Plot to Pdf using Excel Points in VBA Forum</title>
    <link>https://forums.autodesk.com/t5/vba-forum/batch-plot-to-pdf-using-excel-points/m-p/9685518#M4281</link>
    <description>&lt;P&gt;I have developed this code but i am not getting values in point1(0 to 1) , point2(0 to 1).Here is the full code.It shows empty when i run.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;Option Explicit
Public excelApp As Object
Public wbkObj As Object
Public shtObj As Object
Public point1(0 To 1) As Double, point2(0 To 1) As Double


Sub Example_SetWindowToPlot()

' This example plots a pdf file for each frame as the for function selects each frame.
On Error Resume Next
Dim i As Integer
Dim mRow As Integer
Dim backP As Integer

Set excelApp = GetObject(, "Excel.Application")
If Err &amp;lt;&amp;gt; 0 Then
Err.Clear
Set excelApp = CreateObject("Excel.Application")
If Err &amp;lt;&amp;gt; 0 Then
MsgBox "Could not start Excel", vbExclamation
End
End If
End If
excelApp.Visible = True
Set wbkObj = excelApp.Workbooks.Open(filename:="e:\2.xlsx")
Set shtObj = excelApp.Worksheets(1)

mRow = shtObj.Cells.SpecialCells(xlCellTypeLastCell).Row

'Desactivate background plot

For i = 1 To mRow
' Get first point in window

Set excelApp.shtObj.Range(i, 1).Value = point1(0): Set excelApp.shtObj.Range(i, 2).Value = point1(1)
' Get second point in window
Set excelApp.shtObj.Range(i, 3).Value = point2(0): Set excelApp.shtObj.Range(i, 4).Value = point2(1)

AppActivate ThisDrawing.Application.Caption
backP = ThisDrawing.GetVariable("BACKGROUNDPLOT")
ThisDrawing.SetVariable "BACKGROUNDPLOT", 0
'Select printing config
ThisDrawing.ActiveLayout.ConfigName = "DWG to PDF.pc3"

' Send information about window to current layout
ThisDrawing.ActiveLayout.SetWindowToPlot point1, point2

' Read back window information
ThisDrawing.ActiveLayout.GetWindowToPlot point1, point2

' Configure Centerplot to be true
ThisDrawing.ActiveLayout.CenterPlot = True

' Be sure to plot a view, not some other plot style
ThisDrawing.ActiveLayout.PlotType = acWindow

'Name pdf file
Dim plotFileName As String
plotFileName = "C:\Temp\My PDF Plot" &amp;amp; i

'Print pdf
Dim result As Boolean

result = ThisDrawing.Plot.PlotToFile(plotFileName)

Next i

ThisDrawing.SetVariable "BACKGROUNDPLOT", backP


End Sub

&lt;/LI-CODE&gt;</description>
    <pubDate>Wed, 12 Aug 2020 13:21:08 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2020-08-12T13:21:08Z</dc:date>
    <item>
      <title>Batch Plot to Pdf using Excel Points</title>
      <link>https://forums.autodesk.com/t5/vba-forum/batch-plot-to-pdf-using-excel-points/m-p/9685518#M4281</link>
      <description>&lt;P&gt;I have developed this code but i am not getting values in point1(0 to 1) , point2(0 to 1).Here is the full code.It shows empty when i run.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;Option Explicit
Public excelApp As Object
Public wbkObj As Object
Public shtObj As Object
Public point1(0 To 1) As Double, point2(0 To 1) As Double


Sub Example_SetWindowToPlot()

' This example plots a pdf file for each frame as the for function selects each frame.
On Error Resume Next
Dim i As Integer
Dim mRow As Integer
Dim backP As Integer

Set excelApp = GetObject(, "Excel.Application")
If Err &amp;lt;&amp;gt; 0 Then
Err.Clear
Set excelApp = CreateObject("Excel.Application")
If Err &amp;lt;&amp;gt; 0 Then
MsgBox "Could not start Excel", vbExclamation
End
End If
End If
excelApp.Visible = True
Set wbkObj = excelApp.Workbooks.Open(filename:="e:\2.xlsx")
Set shtObj = excelApp.Worksheets(1)

mRow = shtObj.Cells.SpecialCells(xlCellTypeLastCell).Row

'Desactivate background plot

For i = 1 To mRow
' Get first point in window

Set excelApp.shtObj.Range(i, 1).Value = point1(0): Set excelApp.shtObj.Range(i, 2).Value = point1(1)
' Get second point in window
Set excelApp.shtObj.Range(i, 3).Value = point2(0): Set excelApp.shtObj.Range(i, 4).Value = point2(1)

AppActivate ThisDrawing.Application.Caption
backP = ThisDrawing.GetVariable("BACKGROUNDPLOT")
ThisDrawing.SetVariable "BACKGROUNDPLOT", 0
'Select printing config
ThisDrawing.ActiveLayout.ConfigName = "DWG to PDF.pc3"

' Send information about window to current layout
ThisDrawing.ActiveLayout.SetWindowToPlot point1, point2

' Read back window information
ThisDrawing.ActiveLayout.GetWindowToPlot point1, point2

' Configure Centerplot to be true
ThisDrawing.ActiveLayout.CenterPlot = True

' Be sure to plot a view, not some other plot style
ThisDrawing.ActiveLayout.PlotType = acWindow

'Name pdf file
Dim plotFileName As String
plotFileName = "C:\Temp\My PDF Plot" &amp;amp; i

'Print pdf
Dim result As Boolean

result = ThisDrawing.Plot.PlotToFile(plotFileName)

Next i

ThisDrawing.SetVariable "BACKGROUNDPLOT", backP


End Sub

&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 12 Aug 2020 13:21:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/batch-plot-to-pdf-using-excel-points/m-p/9685518#M4281</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-08-12T13:21:08Z</dc:date>
    </item>
    <item>
      <title>Re: Batch Plot to Pdf using Excel Points</title>
      <link>https://forums.autodesk.com/t5/vba-forum/batch-plot-to-pdf-using-excel-points/m-p/9687015#M4282</link>
      <description>&lt;P&gt;You have these 2 lines of code going backward:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;' Get first point in window&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Set excelApp.shtObj.Range(i, 1).Value = point1(0): Set excelApp.shtObj.Range(i, 2).Value = point1(1)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;' Get second point in window&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Set excelApp.shtObj.Range(i, 3).Value = point2(0): Set excelApp.shtObj.Range(i, 4).Value = point2(1)&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;They should be:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;' Get first point in window&lt;BR /&gt;point1(0) = excelApp.shtObj.Range(i, 1).Value:&amp;nbsp;point1(1) = excelApp.shtObj.Range(i, 2).Value&lt;BR /&gt;' Get second point in window&lt;BR /&gt;point2(0) = excelApp.shtObj.Range(i, 3).Value:&amp;nbsp;point2(1) = excelApp.shtObj.Range(i, 4).Value&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Aug 2020 12:32:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/batch-plot-to-pdf-using-excel-points/m-p/9687015#M4282</guid>
      <dc:creator>norman.yuan</dc:creator>
      <dc:date>2020-08-12T12:32:41Z</dc:date>
    </item>
  </channel>
</rss>

