how to print autocad dwg's from excel vba

A

alram

If I have a dwg # in a sheet cell, how can I print that dwg. from excel vba.
This is as far as I got: (I need help with the last 3 lines)

Sub print_dwg_from_excel()
A = ActiveWindow.ActiveCell.Value
B = Dir("c:\AUTOCAD\" & A")
C = "c:\AUTOCAD\" & B
Set fs = CreateObject("SCRIPTING.FILESYSTEMOBJECT")
Set f = fs.GetFile(C)
s = f.PrintOut
End Sub

thanks in advance
Al
 
G

GS

alram wrote on 5/13/2010 :
If I have a dwg # in a sheet cell, how can I print that dwg. from excel vba.
This is as far as I got: (I need help with the last 3 lines)

Sub print_dwg_from_excel()
A = ActiveWindow.ActiveCell.Value
B = Dir("c:\AUTOCAD\" & A")
C = "c:\AUTOCAD\" & B
Set fs = CreateObject("SCRIPTING.FILESYSTEMOBJECT")
Set f = fs.GetFile(C)
s = f.PrintOut
End Sub

thanks in advance
Al

I'm curious as to why you think that FSO will open a .dwg file, OR why
you think you can insert a .dwg into Excel. These are native to
AutoCad, which has printing capability built in. They are not image
files and so at best all you'll get is the binary data, if you get
anything at all.

It sounds to me like you have obtained some .dwg files from somewhere
but you don't have access to AutoCad. In this case, try using DWG
Editor. It's free, and lets you do lots of stuff with the dwg! Just
google to find where it can be downloaded.

GS
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top