Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
I have a macro using which I am exporting some objects to powerpoint.
I dont want the graphs to be exported where there is no data to display. Can anyone help me with this?
Thanks in advance.
Nikhil.
No data available isn't a error - it meant there isn't any data in your object for your certain selection. Therefore you need another approach. A very simply way is to count/sum the main-calculation from your object in a variable and if the result is greater then 0 then there are data available.
var CheckData = if(sum(VALUE) > 0, true(), false())
If ActiveDocument.Variables("CheckData").GetContent.String = true Then
'your Export
else
'nothing
End If
- Marcus
No data available isn't a error - it meant there isn't any data in your object for your certain selection. Therefore you need another approach. A very simply way is to count/sum the main-calculation from your object in a variable and if the result is greater then 0 then there are data available.
var CheckData = if(sum(VALUE) > 0, true(), false())
If ActiveDocument.Variables("CheckData").GetContent.String = true Then
'your Export
else
'nothing
End If
- Marcus
Hi Marcus,
Thanks for the details.
It is working...
In my case I had changed the code a bit. I am using 3 expressions so have created 3 variables and checked if the value is > 0 then export the graph else not.
sub TestData
Set v = ActiveDocument.Variables("vExp1")
vMyExp1 = v.GetContent.String
Set v = ActiveDocument.Variables("vExp2")
vMyExp2 = v.GetContent.String
Set v = ActiveDocument.Variables("vExp3")
vMyExp3 = v.GetContent.String
if vMyExp1 = "0" and vMyExp2 = "0" and vMyExp3 = "0" Then
Msgbox "Do Not Export to Powerpoint"
Else
Msgbox "Export to Powerpoint"
End if
End sub
Thanks for the support.