This might work for you.
Before you run this, go ahead and manually create a tiff from solidworks and make sure the option "view Tif after saving" is turned OFF.
Make tiffs.swp.zip 15.9 KB
Thaks for the quick reply. I was able to use the macro however quickly realized it was most likely not working since i am dealing with parts not drawings. Would you mind changing it to jpegs?
Simply edit the macro and change ".tif" to ".jpg"
As shown here in red.
Dim swApp As Object
Dim swModel As Object
Dim swView As Object
Dim swDraw As Object
Dim swModelDocExt As Object
Dim errors As Long
Dim warnings As Long
Dim bret As Boolean, LoadState As Boolean, OriginalUserSetting As Boolean
Dim t As Long, c As Long, i As Long
Dim compfilename As String, SWfileName As String
Dim objFSO As Object
Dim objFolder As Object
Dim objFile As Object
Private Sub CommandButton1_Click()
If TextBox1.Text = "" Then
MsgBox "Please paste a folder loaction"
If Not Dir(TextBox1.Text, vbDirectory) = vbNullString Then
Set objFSO = New Scripting.FileSystemObject
Set objFolder = objFSO.GetFolder(TextBox1.Text)
Set swApp = CreateObject("SldWorks.Application")
For Each objFile In objFolder.Files
If InStr(1, objFile, ".SLDPRT", 1) > 0 Then
Set swModel = swApp.OpenDoc6(objFile, 1, 1, "", errors, warnings)
Set swModelDocExt = swModel.Extension
SWfileName = swModel.GetTitle
SWfileName = Left(SWfileName, Len(SWfileName) - 7)
swModel.ShowNamedView2 "*Isometric", -1
swModel.Extension.SaveAs TextBox1.Text & "\" & SWfileName & ".jpg", 0, 0, Nothing, errors, warnings
MsgBox "Directory not valid!"
THanks Jason I changed the code, it says done, but there is nothing in the folders. I tried using several different part files and saving in several different folders too.
1. Are the files in a vault or is this a normal wondows directory?
2. Did it open any files?
I tested it first with an open file and ran as a macro. It says complete but didn't do anything.
1) DIrectory on my documents
2) I was using an open file was a test
How should I be running this macro?
I then tried "run custom task" under task scheduler, and mapped to the macro file path but didn't see where I point to the directories.
When you run the macro it should prompt you for a folder location of where the files are.
Sorry Jason! Working perfectly fine now! I Misunderstood that to be the location where the images goto, which why it wasn't working for me.
Thanks for your help!
I should have provided the instructions in my first post.