Paste an image into a solidworks plan (VBA)

Hello

I'm looking to paste an image into Solidworks via excel.
At the moment I can copy my image into Excel. However, I tried the VBA Solid help method to paste it into my plan but I can't adapt it. I pass on my program if anyone knows or I am wrong^^

Sub main()
Set swApp = Application.SldWorks

Established2 = LCase(Established)
Verifier2 = LCase(Verifier)
Approver2 = LCase(Approver)
'---------------------------------------------------------------------------
Name = "BD .xlsx" 'database name
FileLocation = "F:\COMMON\01.Project\Macro\Database\" 'Location of Database


File = File Location & Name ' variable for opening

SetAttr file, vbNormal
Set wb = Workbooks.Open(File) ' the excel database
     
    
Excel.Application.Visible = True ' show excel


ActiveSheet.Shapes(Established2). Copy

        'Workbooks(Noun). Save
        'ActiveWorkbook.Close
        'Excel.Application.Quit
        Set swApp = Application.SldWorks
Status = swModelDocExt.SelectByID2("", "", 1, 1, 1, False, 0, Nothing, 0)
swModel.Paste

Hello

Your "swModel" is not defined, try by putting:

Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
Status = swModel.Extension.SelectByID2("", "", 1, 1, 1, False, 0, Nothing, 0)
swModel.Paste

 

Instead of:

Set swApp = Application.SldWorks
Status = swModelDocExt.SelectByID2("", "", 1, 1, 1, False, 0, Nothing, 0)
swModel.Paste

Kind regards

nickel its walk thank you very much :)