XLSheetMBS GetPicture


I am trying to get a picture of a selected area of a worksheet I just generated using the XL plugin from MBS. To do that, I am using the GetPicture method but can’t make it work.

I wanted to know if people have already used the GetPicture method of XLSheetMBS in the MBS plugins?

  dim book as new XLBookMBS(true)
  book.SetKey(kLicenseXL_name, kLicenseXL_serial)
  book.RgbMode = true
  //Create sheet
  dim sheetName as string = "table_report"
  dim sheet as XLSheetMBS = book.AddSheet(sheetName)
  dim rowTop as integer = 0
  dim colLeft as integer = 0
  dim rowBottom as integer = 10
  dim colRight as integer = 10
  dim width as integer = CTYPE(me.getWidth(sheet),Integer) // Methods that retrieves the pixels size of the selected area (Width)
  dim height as integer = CTYPE(me.getHeight(sheet),Integer) //  Methods that retrieves the pixels size of the selected area (Height)
  dim offSetX as integer = 0
  dim offSetY as integer = 0
  dim index as integer= 0
  dim workbookPictureIndex as integer = sheet.GetPicture(index,rowTop,colLeft,rowBottom,colRight,width,height,offSetX,offSetY)
  msgbox book.ErrorMessage

Note: I don’t know what to put as index, I tried various integer but it’s not working.

the error message returns “ok” but workbookPictureIndex returns -1.

Do someone already succeeded in taking a screenshot from an excel sheet?



GetPicture is to get embedded pictures in the sheet, not a picture of the cells.


is there a way to take a picture using libxl?



Thank you for the answer