Exit VBA Sketch Image

Hello, I managed to automate the import of an image on a solidworks plan but at the end of the sequence the image is selected and I can't leave this selection via my code.

Function codebarreDRAW(FCB As String, namePL As String)
                'Import of the barcode or QRcode on the solidworks plan
'Variable declaration
Dim myModelView As Object
Dim swModel As ModelDoc2
Dim swApp As SldWorks.SldWorks
Dim Errors As Long
Dim swLoadWarnings As Long
Dim Fplan As String
Dim L As Double
Dim H As Double
Dim value As Integer
Dim coef As Double
Dim part As Object
'Variable initialisation
Fplan = namePL & ".SLDDRW"
Set swApp = Application.SldWorks
'Draw window activation
Set swModel = swApp.ActivateDoc3(Fplan, False, swRebuildOnActivation_e.swRebuildActiveDoc, Errors)
Set part = swApp.ActiveDoc
Dim SkPicture As Object
'Insertion of the barcode or QRcode in the draw
Set SkPicture = part.SketchManager.InsertSketchPicture(FCB)
'Retrieving the barcode size
value = SkPicture.GetSize(L, H)
'Definition of the size and position of the bar code
SkPicture.SetSize L * coefAGRimg, H * coefAGRimg, True
SkPicture.SetOrigin PosX, PosY
End Function

 

I'd like to simulate clicking on the green V.

If anyone has an idea, I'm all for it.

 

Thank you

1 Like

It's okay I found, we have to add at the end:

 


part.EditSheet

 

1 Like

Glad I was able to help you! hehe...  Choose the answer that helped you the most to report that the solution has been found;)

2 Likes