Opening DWF and Exporting to DXF

#1
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).]

#2
linking,

Try

Application.ActiveDocument.SaveAs "C:\scrap\testfile.dxf"

This will save the file in the location you want as a dxf.

I tried this and opened the file in notepad and it worked ok.

------------------
Regards
John Finlay

#4
Thanks for your help John

Working well so far, once complete I will post all the code back here so others can use- if that is of use and OK by you.

One quick question - how do I clear the active window so that the imported drawing is cleared each time

The code fragment is

Application.ActiveDocument.Import (dirname & filename)
'imports the dwg

Application.ActiveDocument.SaveAs "c:\scrap\testfile.dxf"
'saves it as a dxf

Application.ActiveDocument.??????????
'how do I clear the document, closing the active window closes the whole drawing, purge only clears the invalid data

Thanks