EYNLLIB Posted August 30, 2024 Posted August 30, 2024 I am creating a program that looks at all the current drawing layouts, and then imports them to a new sheet set. I have it working, but the problem is the sheets are added in numerical order from bottom to top, rather than top to bottom. Anyone have any guidance on controlling the order while importing layouts? Or maybe a better route is to have the sheets re-ordered programmatically once they're imported? Here's the function in question Thanks ' Import a sheet into a sheet set Private Function ImportASheet(ByVal component As IAcSmComponent, _ ByVal title As String, _ ByVal description As String, _ ByVal number As String, _ ByVal fileName As String, _ ByVal layout As String) As AcSmSheet On Error GoTo ErrorHandler Dim sheet As AcSmSheet Dim layoutReference As AcSmAcDbLayoutReference Set layoutReference = New AcSmAcDbLayoutReference layoutReference.InitNew component layoutReference.SetFileName fileName layoutReference.SetName layout If TypeOf component Is AcSmSheetSet Then Dim sheetSet As AcSmSheetSet Set sheetSet = component Set sheet = sheetSet.ImportSheet(layoutReference) If sheet Is Nothing Then Err.Raise vbObjectError + 1001, , "Failed to import sheet into sheet set" End If sheetSet.InsertComponent sheet, Nothing Else Err.Raise vbObjectError + 1002, , "Unexpected component type" End If sheet.SetDesc description sheet.SetTitle title If number <> "" Then sheet.SetNumber number End If Set ImportASheet = sheet Exit Function Quote
EYNLLIB Posted August 30, 2024 Author Posted August 30, 2024 (edited) Okay after checking around the developer help files online, I found out the solution is incredibly easy and simple rather than InsertComponent, I use InsertComponentAfter Edited August 30, 2024 by EYNLLIB Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.