ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to restrict the excel sheet containing Chart (https://www.excelbanter.com/excel-programming/296247-how-restrict-excel-sheet-containing-chart.html)

kvenku[_3_]

How to restrict the excel sheet containing Chart
 
Hi ,
I have created a macros where it contains commondialog control whic
is used to open xls files for some purpose.

I want to restrict if the xls contains chart in it. Is this possible.

I need to open the file which contains onlu datas. No other file shoul
open.

How to do it.

Please help me out.

Thanks

venkatesh

--
Message posted from http://www.ExcelForum.com


Bob Phillips[_6_]

How to restrict the excel sheet containing Chart
 
The only way I could see this working is if you used a naming convention
that identified which files had charts, and then used a filter on this
value.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"kvenku " wrote in message
...
Hi ,
I have created a macros where it contains commondialog control which
is used to open xls files for some purpose.

I want to restrict if the xls contains chart in it. Is this possible.

I need to open the file which contains onlu datas. No other file should
open.

How to do it.

Please help me out.

Thanks

venkatesh.


---
Message posted from http://www.ExcelForum.com/




Dave Peterson[_3_]

How to restrict the excel sheet containing Chart
 
You could check to see if that workbook had any charts in it before your code
continued:

Option Explicit
Function hasCharts(wkbk As Workbook)

Dim sh As Object
Dim FoundOne As Boolean

FoundOne = False
For Each sh In wkbk.Sheets
If LCase(TypeName(sh)) = "worksheet" Then
If sh.ChartObjects.Count 0 Then
FoundOne = True
Exit For
End If
ElseIf LCase(TypeName(sh)) = "chart" Then
FoundOne = True
Exit For
End If
Next sh

hasCharts = FoundOne

End Function


Sub testme01()

If hasCharts(ActiveWorkbook) = False Then
MsgBox "no charts"
Exit Sub
End If

'existing code here

End Sub


"kvenku <" wrote:

Hi ,
I have created a macros where it contains commondialog control which
is used to open xls files for some purpose.

I want to restrict if the xls contains chart in it. Is this possible.

I need to open the file which contains onlu datas. No other file should
open.

How to do it.

Please help me out.

Thanks

venkatesh.

---
Message posted from http://www.ExcelForum.com/


--

Dave Peterson



All times are GMT +1. The time now is 08:42 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com