No compiled code to run error BC30456

Hi Team,
I get an error when I run the following code.
Please find the attached screenshot.

Please help in solving the issue!
Thanks in advance,
TuanNNA

Invoke code: No compiled code to run
error BC30456: 'Clipboard' is not a member of 'System.Windows.Forms'. At line 12


Dim xlWorkBook As  Microsoft.Office.Interop.Excel.Workbook
Dim xlWorkSheet As Microsoft.Office.Interop.Excel.Worksheet
Dim xlRange As Microsoft.Office.Interop.Excel.Range

Try

app.DisplayAlerts=False
xlWorkBook=app.Workbooks.Open(filePath)
xlWorkSheet = CType(xlWorkBook.Sheets(SheetName), Microsoft.Office.Interop.Excel.Worksheet)
xlWorksheet.Range(Range).CopyPicture(Microsoft.Office.Interop.Excel.XlPictureAppearance.xlScreen, Microsoft.Office.Interop.Excel.XlCopyPictureFormat.xlBitmap)

System.Windows.Forms.Clipboard.GetImage.Save(ImagePath, System.Drawing.Imaging.ImageFormat.Jpeg)
xlWorkBook.Close

Console.WriteLine("Image placed in: " + ImagePath)

Catch e As Exception
	xlWorkBook.Close
exceptionMessage =exceptionMessage + e.Message
End Try

Hi @Tuannna1 ,

Please have a look at the below link.
Clipboard’ is not a member of ‘System.Windows.Forms’ Used to paste files to folder

Regards.

@Tuannna1

Try with system.windows.clipboard

Cheers