Hello,
I am trying to iterate through a directory and save all the existing DXF files to version 2004. Everything works well until I try to "SaveAs". I've included the entire routine here. If anyone could help, I would greatly appreciate it.
Thank You,
Eric.
________________________________________________________________________________
Imports Autodesk.AutoCAD
Imports System.IO
Private Sub ResetDXFFilesToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ResetDXFFilesToolStripMenuItem.Click
Dim strJobNum As String = Nothing
If TextBoxJobNumber.Text = "" Then
strJobNum = InputBox("Please Type A Job Number", "Job Number?", "00000")
Else
strJobNum = TextBoxJobNumber.Text
End If
' Find Directory
Dim strDir As String = Nothing
strDir = "J:\" & strJobNum & "\DXF"
If Directory.Exists(strDir) Then
Dim AcadApp As AcadApplication
AcadApp = CreateObject("Autocad.Application")
' Show AutoCad or Not
AcadApp.Visible = False
Dim acadDoc As AcadDocument
acadDoc = AcadApp.ActiveDocument
Dim CollDoc As AcadDocuments
CollDoc = AcadApp.Documents
Dim NewCurrentDirectory As DirectoryInfo = New DirectoryInfo(strDir)
If NewCurrentDirectory.Exists Then
Dim fileArray As FileInfo() = NewCurrentDirectory.GetFiles
For Each oFile In fileArray
If oFile.Extension = ".dxf" Then
CollDoc.Open(oFile.FullName)
acadDoc = AcadApp.ActiveDocument
acadDoc.ActiveSpace = Interop.Common.AcActiveSpace.acModelSpace
' Here Is the Problem
'acadDoc.SaveAs(oFile.FullName,?????????
acadDoc.Close()
End If
Next
End If
Else
MessageBox.Show("Job Number: " & strJobNum & " doesn't exist." & vbCr & "I'm exiting without doing anything", "Invalid Job Number", MessageBoxButtons.OK, MessageBoxIcon.Stop)
End If
End Sub