Message 1 of 1
Saveas DWT file

Not applicable
11-14-2008
12:35 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
The following function seems like it should work but gives an error when I tried to use the Saveas function with the filetype for AutoCAD 2009.
The function loops though a Structure set of DWG file names to "saveas" DWT files.
How do I save to a template file (DWT)?
(This is for VB.net 2005)
Private Sub cmdConvertDWT_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdConvertDWT.Click
Dim i As Int16 = 0
Dim NewFileName As String = "", fileName As String = ""
Dim strFileType As String = "ac2004_Template"
Try
Call GetAcad()
Call GetDocuments("dwg")
For i = 0 To FileInfoList.Length - 1
If FileInfoList(i).FullName <> Nothing Then
fileName = FileInfoList(i).FullName
acadApp.Documents.Open(fileName, True, )
NewFileName = Replace(FileInfoList(i).FullName, FileInfoList(i).Ext, "")
acadApp.Documents.Application.ActiveDocument.SaveAs(NewFileName, strFileType)
acadApp.Documents.Close()
End If
Next
Catch Ex As Exception
acadApp.Documents.Close()
End Try
End Sub
Edited by: david.m.johnson1@us.army.mil on Nov 14, 2008 8:38 PM Edited by: david.m.johnson1@us.army.mil on Nov 14, 2008 9:35 PM
The function loops though a Structure set of DWG file names to "saveas" DWT files.
How do I save to a template file (DWT)?
(This is for VB.net 2005)
Private Sub cmdConvertDWT_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdConvertDWT.Click
Dim i As Int16 = 0
Dim NewFileName As String = "", fileName As String = ""
Dim strFileType As String = "ac2004_Template"
Try
Call GetAcad()
Call GetDocuments("dwg")
For i = 0 To FileInfoList.Length - 1
If FileInfoList(i).FullName <> Nothing Then
fileName = FileInfoList(i).FullName
acadApp.Documents.Open(fileName, True, )
NewFileName = Replace(FileInfoList(i).FullName, FileInfoList(i).Ext, "")
acadApp.Documents.Application.ActiveDocument.SaveAs(NewFileName, strFileType)
acadApp.Documents.Close()
End If
Next
Catch Ex As Exception
acadApp.Documents.Close()
End Try
End Sub
Edited by: david.m.johnson1@us.army.mil on Nov 14, 2008 8:38 PM Edited by: david.m.johnson1@us.army.mil on Nov 14, 2008 9:35 PM