In my code everything works well except for the third to last line which returns an "Application defined or Object defined" error.
The offending line is:
I suspect that the problem lies in the fact that I am have saved the file in the text format but I am not sure. Any help is appreciated.
Here is the code I have written.
The offending line is:
Code:
ActiveWorkbook.Close SaveChanges:=True
I suspect that the problem lies in the fact that I am have saved the file in the text format but I am not sure. Any help is appreciated.
Here is the code I have written.
Code:
Sub Open_DXF()
Application.ScreenUpdating = False
Dim MainF As String, Mainb As String, f_t As String, r As Integer
Dim FolderName As String
FolderName = FuncGetFolderName("Select source folder for DXF file to be converted.")
"CODE DELETED FOR SPACE CONSERVATION"
OPEN_THIS_FILE:
Workbooks.OpenText Filename:=FolderName & "\" & MainF, Origin:=437, StartRow:=1, DataType:=xlDelimited, TextQualifier:= _
xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, Semicolon:=False, _
Comma:=False, Space:=False, Other:=False, FieldInfo:=Array(1, 1), _
TrailingMinusNumbers:=True
ActiveWorkbook.Worksheets(1).Range("A:A").Copy Destination:=Workbooks("DXF Conversion1").Worksheets("Sheet1").Range("A:A")
ActiveWindow.Close
Windows("DXF conversion1").Activate
'Begin conversion of DXF to G-code
Run "Extract_Coordinates"
'G-code is ready to be saved.
If MsgBox("Save the G-code in the same folder?", vbYesNo) = vbNo Then
FolderName = FuncGetFolderName("Select destination folder")
End If
Cells(1, 1) = MainF
ActiveWorkbook.SaveAs Filename:=FolderName & "\" & MainF & ".tap", FileFormat:=xlText
MsgBox ("The new file """ & MainF & """ has been saved in folder """ & FolderName & """")
Application.ScreenUpdating = True
Application.ScreenUpdating = False
ActiveWorkbook.Close SaveChanges:=True
999:
End Sub