AnsweredAssumed Answered

Macro to insert jpg onto drawing sheet - help

Question asked by Garret Hansen on Feb 9, 2012
Latest reply on Feb 10, 2012 by Garret Hansen



I found a way to insert a jpg onto my sheet in a specific spot and scaled to a specific size as follows:


Dim swApp As Object

Dim Part As Object
Dim boolstatus As Boolean
Dim longstatus As Long, longwarnings As Long

Sub main()

Set swApp = _

Set Part = swApp.ActiveDoc
Dim SkPicture As Object
Set SkPicture = Part.SketchManager.InsertSketchPicture("U:\My Documents\image.JPG")
SkPicture.SetOrigin 0.335, 0.162
SkPicture.SetSize 0.035, 0.035, 1

End Sub


The only issue is that because the drawing may be at a different scale depending on the part depicted the image is not in the correct place or correct size.  To get around this I have to right click on the sheet and edit sheet format, then run the macro and then exit back out of the sheet format edit.  I would like to be able to add code to the macro so that it goes into the edit sheet format, places the image, then exits back out.  I only need to be able to do this one sheet at a time as most of my drawings only have a single sheet.


This code was edited from code I found on the net so I am really a beginner (hack).


Any help would be greatly appreciated.





Garret Hansen