Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

worksheet is chart? 2

Status
Not open for further replies.

venkman

Programmer
Oct 9, 2001
467
US
How can you tell if a sheet is a chart. For instance, I'm looking for the code for the function:

public function isChart(mySheet as variant) as boolean
...
end function

public sub tester()
dim myVar as variant
set myvar = sheets(1)
if isChart(myvar) then
msgbox "chart title is: " & myvar.Charttitle.Caption
else
msgbox "chart title is: " & _
myvar.Chartobjects(1).Chart.Charttitle.Caption
end if
end sub


Thanks,
Venkman
 
Something like this has come up recently, but try the following function :
Code:
Function IsChart(oSheet As Variant) As Boolean
    If TypeName(oSheet) = "Chart" Then
        IsChart = True
    Else
        IsChart = False
    End If
End Function

and use something like

MsgBox IsChart(ActiveSheet)

A.C.
 
Hi,

Try this...
Code:
Public Function isChart(mySheet As Object) As Boolean
    If mySheet.Type = 3 Then
        isChart = True
    Else
        isChart = False
    End If
End Function
Skip,
SkipAndMary1017@mindspring.com
 
acron, tried your message and it worked great. Skip, didn't try yours, but I assume it works fine also. Giving you both stars.

Thanks,
Venkman
 
oh, wrote that too fast meant to say "method" not "message".
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top