Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Exported Sheet is blank

Hello QV Users,

I have a document where I need to export multiple sheets to image files. I have the macro to export the sheet correct (macro below) but only the sheet that is active exports correctly. The other sheet that is not active exports as a blank image.

Macro:

sub exportToFolder

GraphPath = '\\smdapp02\Qlikview\Models'

ActiveDocument.Sheets("Dashboard").ExportBitmapToFile GraphPath & "A.jpg"

ActiveDocument.Sheets("Master Dashboard").ExportBitmapToFile GraphPath & "B.jpg"

end sub

Please could someome help me with this. I would really appreciate it.

Thanks,

S

1 Solution

Accepted Solutions
Not applicable
Author

Hi Shane,

Put the WaitForIdle after the Activate method and then the Export... your code should look like

...Sheets("Master Dashboard").Activate

...WaitForIdle

...Export

Wait for idle will essentially wait for the screen to be painted before it goes to the next line of code which is Export

I hope this helps.

Though, if there is an update to the plug-in which you don't have to activate the sheet, its much better. Though, I tested V10 just now and it still have the same behavior as 9.x.

View solution in original post

10 Replies
Not applicable
Author

Dear shanejvv

Please check for the version of plugin and QV installled

Not applicable
Author

Hi Rishi,

Version is : 9.00.7320.7 SR2

How do I check the plugin version?

tx,

S



Not applicable
Author

Not the cleanness way but a workaround would be to Activate the sheet first and then execute the WaitForIdle method

i.e.

... remember the active sheet

ActiveDocument.Sheets("Master Dashboard").Activate
ActiveDocument.GetApplication.WaitForIdle

... export master dashboard

... return to the previous dashboard

i hope this helps.

Not applicable
Author

go to add and remove programs in administrative tools then on Qlikview plugin clik on more details you will get the version of plugin

Not applicable
Author

Hi,
As Pinongs suggested, you need to reactivate the sheet(s) in question and although it's a pain, invoke 'WaitForIdle' and 'ClearCache'. The following code works for exporting to PowerPoint and you should be able to mangle it for jpg's:

set s=ActiveDocument.Sheets("PPT_Presentation")
ActiveDocument.Sheets("PPT_Presentation").Activate
ActiveDocument.ClearCache
ActiveDocument.GetApplication.WaitForIdle
ActiveDocument.GetSheetObject("TX140").Restore
ActiveDocument.GetSheetObject("TX140").CopyTextToClipboard
PPApp.Visible = True
Set PPSlide = PPPres.Slides(1)
PPSlide.Shapes(4).TextFrame.TextRange.Paste
PPSlide.Shapes(4).Left = 28.3447
PPSlide.Shapes(4).Top = 204.6485
PPSlide.Shapes(4).Height = 29.195
PPSlide.Shapes(4).Width = 655.6122
Set PPShapes = PPPres.Slides(1).Shapes(4).TextFrame.TextRange
PPShapes.Font.Name = "Tahoma"
PPShapes.Font.Color.RGB = RGB(25,77,109)
Set PPFont = PPPres.Slides(1).Shapes(4).TextEffect
PPFont.FontSize = 28
ActiveDocument.GetSheetObject("TX140").Minimize
ActiveDocument.GetApplication.WaitForIdle
ActiveDocument.ClearCache

set s=ActiveDocument.Sheets("PPT_Presentation")
ActiveDocument.Sheets("PPT_Presentation").Activate
ActiveDocument.ClearCache
ActiveDocument.GetApplication.WaitForIdle
ActiveDocument.GetSheetObject("TX141").Restore
ActiveDocument.GetSheetObject("TX141").CopyTextToClipboard
PPApp.Visible = True
Set PPSlide = PPPres.Slides(1)
PPSlide.Shapes(5).TextFrame.TextRange.Paste
PPSlide.Shapes(5).Left = 28.3447
PPSlide.Shapes(5).Top = 238.0952
PPSlide.Shapes(5).Height = 29.195
PPSlide.Shapes(5).Width = 655.6122
Set PPShapes = PPPres.Slides(1).Shapes(5).TextFrame.TextRange
PPShapes.Font.Name = "Tahoma"
PPShapes.Font.Color.RGB = RGB(25,77,109)
Set PPFont = PPPres.Slides(1).Shapes(5).TextEffect
PPFont.FontSize = 28
ActiveDocument.GetSheetObject("TX141").Minimize
ActiveDocument.GetApplication.WaitForIdle
ActiveDocument.ClearCache

set s=ActiveDocument.Sheets("PPT_Presentation")
ActiveDocument.Sheets("PPT_Presentation").Activate
ActiveDocument.ClearCache
ActiveDocument.GetApplication.WaitForIdle
ActiveDocument.GetSheetObject("TX142").Restore
ActiveDocument.GetSheetObject("TX142").CopyTextToClipboard
PPApp.Visible = True
Set PPSlide = PPPres.Slides(1)
PPSlide.Shapes(6).TextFrame.TextRange.Paste
PPSlide.Shapes(6).Left = 28.3447
PPSlide.Shapes(6).Top = 272.1088
PPSlide.Shapes(6).Height = 29.195
PPSlide.Shapes(6).Width = 655.6122
Set PPShapes = PPPres.Slides(1).Shapes(6).TextFrame.TextRange
PPShapes.Font.Name = "Tahoma"
PPShapes.Font.Color.RGB = RGB(25,77,109)
Set PPFont = PPPres.Slides(1).Shapes(6).TextEffect
PPFont.FontSize = 28
ActiveDocument.GetSheetObject("TX142").Minimize
ActiveDocument.GetApplication.WaitForIdle
ActiveDocument.ClearCache

Good luck!

Not applicable
Author

Thanks for all the replies. I have changed my macro to include WaitForIdle and ClearCache but I still get one blank image.

I've changed it to:

sub exportDash

GraphPath = '\\smdapp02\Qlikview\Models\'

ActiveDocument.Sheets("Dashboard").Activate

ActiveDocument.Sheets("Dashboard").ExportBitmapToFile GraphPath & "Dashboard.jpg"

ActivateDocument.GetApplication.WaitForIdle

ActiveDocument.ClearCache

ActiveDocument.Sheets("Master Dashboard").Activate

ActiveDocument.Sheets("Master Dashboard").ExportBitmapToFile GraphPath & "Master_Dashboard.jpg"

ActivateDocument.GetApplication.WaitForIdle

ActiveDocument.ClearCache

As I understand it, ClearCache will clear the memory so that a new image can be placed into memory and WaitForIdle makes sure that the exporting process is done. Am I right in saying this? Why would a blank image still be exporting for Master Dashboard?

Thanks for the help guys!

S

Not applicable
Author

Hi,
Is the sheet "Master Dashboard" or has it got an underscore in it ["Master_Dashboard"]? Also, have you tried just exporting the Master file? Is the app cutting back to the macro and coming up with an error message [which it normally would]? Finally, as I've managed to do this myself in the past..........is there data in the master file?

Not applicable
Author

Jon,

The sheet is just called "Master Dashboard" with no underscore but I've added an underscore on the file it creates. Exporting only one file is okay but then when you create a new sub for the second image, it reverts back to exporting only one again. No error appears, it goes through okay and even creates the file but that image is blank. There is data on both sheets.

thanks,

Shane

Not applicable
Author

Hi Shane,

Put the WaitForIdle after the Activate method and then the Export... your code should look like

...Sheets("Master Dashboard").Activate

...WaitForIdle

...Export

Wait for idle will essentially wait for the screen to be painted before it goes to the next line of code which is Export

I hope this helps.

Though, if there is an update to the plug-in which you don't have to activate the sheet, its much better. Though, I tested V10 just now and it still have the same behavior as 9.x.