VBA Code to print Solid Edge .DFT drawings

darkrid3r

New Member
Joined
Sep 6, 2011
Messages
9
Hi,

i would really like to be able to print a serie of .dft files with a list generated in excel.

I've search over the web and found two sites that might help but i am far from being able to do anything with it since I never worked with framework stuff.

Here are the two sites :

This guy said the code worked to print just like i want, but it doesn't work for me (getting an error at Dim objApp As SolidEdgeFramework.Application User-defined type not defined)

http://www.jasonnewell.net/forums/solid-edge-programming/556-printing-a-dft-using-vba-in-excel.html

And the second site contains Framework stuff, which i don't quite understand to be really honest.

http://www.codeproject.com/Articles/33576/Solid-Edge-ST-Addins-Part-I

Thanks a lot in advance.
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
Hi,

I still have a problem with my code. I use this code to print in PDF all my dft. I would like the code to update the DFT if needed, because sometimes they are not. I tried solidedgedraft.DrawingView.Update and solidedgedraft.DrawingView.forceUpdate but it didn't work.

Code:
Sub PrintDraft()
Dim objApp As SolidEdgeFramework.Application
Dim objDoc As solidedgedraft.DraftDocument
Dim objSheet As solidedgedraft.Sheet

Dim FilePath_VA As String
Dim PrinterName_VA As String
Dim SEprinter_VA As String
Dim x As Integer
Dim message As String

message = "Please Wait - Opération en cours"


Application.StatusBar = message

PrinterName_VA = Application.ActivePrinter
SEprinter_VA = GetDefaultPrinterName

On Error Resume Next

Set objApp = GetObject(, "SolidEdge.Application")

If Err Then
Err.Clear

    Set objApp = CreateObject("SolidEdge.Application")
    objApp.DisplayAlerts = False
    
    If Worksheets("Print List").Range("Q1").Value > 0 Then

        For x = Worksheets("Print List").Range("Q1").Value To Worksheets("Print List").Range("R1").Value
        Application.StatusBar = message & "."
        If Worksheets("Print List").Range("P" & x).Value <> "" Then

            FilePath_VA = Worksheets("Print List").Range("P" & x).Value
        
            Set objDoc = objApp.Documents.Open(FilePath_VA)
        

            objApp.Visible = True
            
            
            solidedgedraft.DrawingView.Update
            solidedgedraft.DrawingView.ForceUpdate
            ' Find the default printer using the API
            
            objDoc.PrintOut SEprinter_VA, Orientation:=2
            Call objDoc.Close
        
        End If
    
        Next
    
    End If
    

End If
Application.StatusBar = False
Call objApp.Quit

Set objApp = Nothing
Set objDoc = Nothing
Set objSheet = Nothing

End Sub

Thanks
 
Upvote 0

Forum statistics

Threads
1,225,669
Messages
6,186,346
Members
453,349
Latest member
neam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top