Opening DWF and Exporting to DXF
Posted: Wed Jun 28, 2006 8:55 pm
I am attempting to use a VBA script to do this task
The code so far is as below
___________________________________________
Private Sub Export_to_DXF()
Dim filename As String
Dim dirname As String
Dim lastthree As String
Dim lasteight As String
Dim sset As Object
Dim pViewport As Object
dirname = "C:\18038\"
filename = Dir(dirname, vbNormal)
'retrieve the first entry
Do While filename <> ""
'start the loop
If UCase(Right$(filename, 4)) = ".DWG" Then
'ignore files that do not end with .DWG
lastthree = Mid$(filename, Len(filename) - 6, 3)
If (lastthree = "010") Or (lastthree = "101") Or (lastthree = "201") Then
If (GetAttr(dirname & filename) And vbNormal) = vbNormal Then
'use bitwise comparison to make sure filename is not a directory
Application.ActiveDocument.Import (dirname & filename)
Application.ActiveDocument.Export ("C:\scrap\testfile.dxf","dxf") '<<--- gives and error when compiled of "= needed"
End If
End If
End If
filename = Dir
'get next entry
Loop
____________________________________________
Has anyone any hints how to achieve this ?
Thanks
[This message has been edited by linking (edited 06-28-2006).]
The code so far is as below
___________________________________________
Private Sub Export_to_DXF()
Dim filename As String
Dim dirname As String
Dim lastthree As String
Dim lasteight As String
Dim sset As Object
Dim pViewport As Object
dirname = "C:\18038\"
filename = Dir(dirname, vbNormal)
'retrieve the first entry
Do While filename <> ""
'start the loop
If UCase(Right$(filename, 4)) = ".DWG" Then
'ignore files that do not end with .DWG
lastthree = Mid$(filename, Len(filename) - 6, 3)
If (lastthree = "010") Or (lastthree = "101") Or (lastthree = "201") Then
If (GetAttr(dirname & filename) And vbNormal) = vbNormal Then
'use bitwise comparison to make sure filename is not a directory
Application.ActiveDocument.Import (dirname & filename)
Application.ActiveDocument.Export ("C:\scrap\testfile.dxf","dxf") '<<--- gives and error when compiled of "= needed"
End If
End If
End If
filename = Dir
'get next entry
Loop
____________________________________________
Has anyone any hints how to achieve this ?
Thanks
[This message has been edited by linking (edited 06-28-2006).]