how to: export all drawings in a folder to bitmap or other f
CADForums.net Forum Index CADForums.net
Discussion of AutoCAD and other CAD software.
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Google
 
Web cadforums.net
how to: export all drawings in a folder to bitmap or other f

 
Post new topic   Reply to topic    CADForums.net Forum Index -> VBA
Author Message
vindimy



Joined: 19 Oct 2005
Posts: 4

Posted: Fri Oct 21, 2005 12:10 am    Post subject: how to: export all drawings in a folder to bitmap or other f Reply with quote

here's the code i wrote when i needed a routine that could export all
of my drawings into .bmp files... hope someone finds it useful.

Sub exportAllBlocks()
On Error GoTo Err_Control

Dim strFolder As String, strSubFolder As String, intI As Integer
Dim fso As Scripting.FileSystemObject, folder As Scripting.folder,
file As Scripting.file
Dim objDrawing As AcadDocument, objBlock As AcadBlock, objEntity As
AcadEntity, selSet1 As AcadSelectionSet

strFolder = "P:\s100127_bar scanner-cad
integration\Working\symbols\dmitriy_18-oct-05\"
strSubFolder = "P:\\s100127_bar scanner-cad
integration\\Working\\symbols\\dmitriy_18-oct-05\\img\\"

Set fso = New Scripting.FileSystemObject
Set folder = fso.GetFolder(strFolder)

'ThisDrawing.Close

For Each file In folder.Files
Set objDrawing = Application.Documents.Open(strFolder &
file.Name)
objDrawing.Activate

Application.ZoomExtents

objDrawing.SendCommand "(command " & Chr(34) & "export" &
Chr(34) & " " & Chr(34) & strSubFolder & file.Name & ".bmp" & Chr(34) &
" " & Chr(34) & "all" & Chr(34) & " " & Chr(34) & "" & Chr(34) & ")" &
vbCr

Application.ZoomExtents
objDrawing.Save
objDrawing.Close
Next file

MsgBox "Done!", vbOKOnly, "Done"

Err_Control:
If Err.Number <> 0 Then
MsgBox "Error: " & Err.Description, vbCritical, Err.Number
End If
Exit Sub
End Sub

Back to top
View user's profile Send private message Yahoo Messenger
 
Post new topic   Reply to topic    CADForums.net Forum Index -> VBA All times are GMT
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




Windows Server DSP VoIP Electronics New Topics
Powered by phpBB