Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Export image to Excel

hi

I want to export the  bar Graph to Excel

I have used the following code

set obj = ActiveDocument.GetSheetObject("Chart ID")

   obj.CopyBitmapToClipBoard

   XLSheet.Range("A1").Select

   XLDoc.Sheets("Sheet1").Paste

but the problem is it stops at "Copy" Command and worse is Macro does not showed any Error.

9 Replies
Not applicable
Author

try this hope this helps you

Sub ExportGraph()
Dim vSheet
Set XLApp = CreateObject("Excel.Application")
XLApp.Visible = TRUE
Set XLDoc = XLApp.Workbooks.Add
vSheet = ""
vSheet = "Sheet1"
ActiveDocument.GetSheetObject("CH26").CopyBitmapToClipboard 'Copy the charts
XLDoc.Sheets(vSheet).Range("A" & 1).Select
XLDoc.Sheets(vSheet).Paste

Set XLDoc = Nothing
Set XLApp = Nothing


End Sub

Not applicable
Author

It stops  "ActiveDocument.GetSheetObject("CH26").CopyBitmapToClipboard " here only

does not showed any error

markodonovan
Specialist
Specialist

Hi Avadhoot,

Try this macro to export a bitmap to excel:

Sub ExportBitmap()

Set Doc = ActiveDocument

Set obj = Doc.GetSheetObject("CH27")

Set XLApp = CreateObject("Excel.Application")

XLApp.Visible = True

'Create a new excel worksheet

Set XLDoc = XLApp.Workbooks.Add

obj.CopyBitmapToClipboard

XLDoc.Worksheets(1).Paste

End Sub

Thanks

Mark

http://practical-qlik.com

https://twitter.com/PracticalQlik

http://practical-qlikview.tumblr.com

Not applicable
Author

No it gives same error...................

markodonovan
Specialist
Specialist

Hi Avadhoot,

Try pressing Ctrl+Shift+M and change the module security to the same as the screenshot to see if this solves the problem.

Mark

http://practical-qlik.com

https://twitter.com/PracticalQlik

http://practical-qlikview.tumblr.com

Not applicable
Author

Nop.... pop up is not viewed

But I updated "Requested module security"  and "Current local security" to "System access" and "Allow system access" already....

Not applicable
Author

Hi

Sorry Mark ..

The pop up was thr

n I tried as u said

but its no use..

Not applicable
Author

Did you find in which line error execution failed?

write difference msg box on different lines to find the line of execution failed..

Karthik

Not applicable
Author

Vishwa's macro working simply. Make sure you are changed chart ID correctly

Karthik