Message 1 of 6
Adding a New Layout Using a Template
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I'm fairly new to VBA and learning from code I read from books and online. What I need to do is create a function that will createa new layout tab from a template file on the network. I have seen some code, but they are using the template name and that's about it (from what I can tell). I have templates that have multiple layouts in them. So what I need to do is input a specific layout tab from the template as the new layout template in my drawing.
Here is a portion of my code:
'Add a layout from a template
ThisDrawing.SetVariable "SDI", 1 'Single Document Interface or MDI
Dim template_path As String 'path for templates
Dim templateName As String 'name of the template
Dim templateFileName As String 'full path and template name
template_path = "S:\templates\"
'Determine the correct template
Select Case DrawingType
Case "DrawType_1"
templateName = "Template1.dwt"
Case "DrawType_2"
templateName = "Template2.dwt"
Case "DrawType_3"
templateName = "Template3.dwt"
Case Else
templateName = "Standard.dwt"
End Select
templateFileName = template_path & templateName
ThisDrawing.New templateFileName
So, for example, Template2.dwt has 3 layouts (T1, T2, T3). What is the command to insert the third layout from the template into my drawing as a new layout?
Thanks,
Mark
I'm fairly new to VBA and learning from code I read from books and online. What I need to do is create a function that will createa new layout tab from a template file on the network. I have seen some code, but they are using the template name and that's about it (from what I can tell). I have templates that have multiple layouts in them. So what I need to do is input a specific layout tab from the template as the new layout template in my drawing.
Here is a portion of my code:
'Add a layout from a template
ThisDrawing.SetVariable "SDI", 1 'Single Document Interface or MDI
Dim template_path As String 'path for templates
Dim templateName As String 'name of the template
Dim templateFileName As String 'full path and template name
template_path = "S:\templates\"
'Determine the correct template
Select Case DrawingType
Case "DrawType_1"
templateName = "Template1.dwt"
Case "DrawType_2"
templateName = "Template2.dwt"
Case "DrawType_3"
templateName = "Template3.dwt"
Case Else
templateName = "Standard.dwt"
End Select
templateFileName = template_path & templateName
ThisDrawing.New templateFileName
So, for example, Template2.dwt has 3 layouts (T1, T2, T3). What is the command to insert the third layout from the template into my drawing as a new layout?
Thanks,
Mark