xref: /AOO41X/main/migrationanalysis/src/driver_docs/sources/excel/MigrationAnalyser.cls (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1*cdf0e10cSrcweirVERSION 1.0 CLASS
2*cdf0e10cSrcweirBEGIN
3*cdf0e10cSrcweir  MultiUse = -1  'True
4*cdf0e10cSrcweirEND
5*cdf0e10cSrcweirAttribute VB_Name = "MigrationAnalyser"
6*cdf0e10cSrcweirAttribute VB_GlobalNameSpace = False
7*cdf0e10cSrcweirAttribute VB_Creatable = False
8*cdf0e10cSrcweirAttribute VB_PredeclaredId = False
9*cdf0e10cSrcweirAttribute VB_Exposed = False
10*cdf0e10cSrcweir'/*************************************************************************
11*cdf0e10cSrcweir' *
12*cdf0e10cSrcweir' DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
13*cdf0e10cSrcweir'
14*cdf0e10cSrcweir' Copyright 2000, 2010 Oracle and/or its affiliates.
15*cdf0e10cSrcweir'
16*cdf0e10cSrcweir' OpenOffice.org - a multi-platform office productivity suite
17*cdf0e10cSrcweir'
18*cdf0e10cSrcweir' This file is part of OpenOffice.org.
19*cdf0e10cSrcweir'
20*cdf0e10cSrcweir' OpenOffice.org is free software: you can redistribute it and/or modify
21*cdf0e10cSrcweir' it under the terms of the GNU Lesser General Public License version 3
22*cdf0e10cSrcweir' only, as published by the Free Software Foundation.
23*cdf0e10cSrcweir'
24*cdf0e10cSrcweir' OpenOffice.org is distributed in the hope that it will be useful,
25*cdf0e10cSrcweir' but WITHOUT ANY WARRANTY; without even the implied warranty of
26*cdf0e10cSrcweir' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
27*cdf0e10cSrcweir' GNU Lesser General Public License version 3 for more details
28*cdf0e10cSrcweir' (a copy is included in the LICENSE file that accompanied this code).
29*cdf0e10cSrcweir'
30*cdf0e10cSrcweir' You should have received a copy of the GNU Lesser General Public License
31*cdf0e10cSrcweir' version 3 along with OpenOffice.org.  If not, see
32*cdf0e10cSrcweir' <http://www.openoffice.org/license.html>
33*cdf0e10cSrcweir' for a copy of the LGPLv3 License.
34*cdf0e10cSrcweir'
35*cdf0e10cSrcweir' ************************************************************************/
36*cdf0e10cSrcweirOption Explicit
37*cdf0e10cSrcweir
38*cdf0e10cSrcweirConst CWORKBOOK_SHEETS_LIMIT = 256
39*cdf0e10cSrcweir
40*cdf0e10cSrcweir'Class variables
41*cdf0e10cSrcweirPrivate Enum HFIssueType
42*cdf0e10cSrcweir    hfInline
43*cdf0e10cSrcweir    hfShape
44*cdf0e10cSrcweir    hfFrame
45*cdf0e10cSrcweirEnd Enum
46*cdf0e10cSrcweir
47*cdf0e10cSrcweirPrivate Enum HFIssueLocation
48*cdf0e10cSrcweir    hfHeader
49*cdf0e10cSrcweir    hfFooter
50*cdf0e10cSrcweirEnd Enum
51*cdf0e10cSrcweir
52*cdf0e10cSrcweirPrivate Type CellAtrributes
53*cdf0e10cSrcweir    LineStyle As Integer
54*cdf0e10cSrcweir    FillPattern As Integer
55*cdf0e10cSrcweirEnd Type
56*cdf0e10cSrcweir
57*cdf0e10cSrcweirPrivate Type BadSheetNameChar
58*cdf0e10cSrcweir    BadChar As String
59*cdf0e10cSrcweir    Position As Integer
60*cdf0e10cSrcweirEnd Type
61*cdf0e10cSrcweir
62*cdf0e10cSrcweirPrivate mAnalysis As DocumentAnalysis
63*cdf0e10cSrcweirPrivate mFileName As String
64*cdf0e10cSrcweir
65*cdf0e10cSrcweirConst RID_STR_EXCEL_SUBISSUE_ERROR_TYPE = "ERROR.TYPE"
66*cdf0e10cSrcweirConst RID_STR_EXCEL_SUBISSUE_INFO = "INFO"
67*cdf0e10cSrcweirConst RID_STR_EXCEL_SUBISSUE_DATEDIF = "DATEDIF"
68*cdf0e10cSrcweirConst RID_STR_EXCEL_SUBISSUE_PHONETIC = "PHONETIC"
69*cdf0e10cSrcweirConst FontError = 94
70*cdf0e10cSrcweirConst CR_BADCHAR = "<TOKEN1>"
71*cdf0e10cSrcweirConst CR_BADCHARNUM = "<TOKEN2>"
72*cdf0e10cSrcweirConst DATA_SOURCE_EXCEL = 0
73*cdf0e10cSrcweirConst DATA_SOURCE_EXTERNAL = 1
74*cdf0e10cSrcweirConst DATA_SOURCE_MULTIPLE = 2
75*cdf0e10cSrcweirConst DATA_SOURCE_EXTERNAL_FILE = 3
76*cdf0e10cSrcweirConst C_MAX_CELL_RANGE_COUNT = 10000
77*cdf0e10cSrcweir
78*cdf0e10cSrcweirPrivate Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
79*cdf0e10cSrcweir
80*cdf0e10cSrcweir'***ADDING-ISSUE: Use Following Skeleton as Guideline for Adding Issue
81*cdf0e10cSrcweir' For complete list of all RID_STR_... for Issues (IssueType), SubIssues (SubType) and Attributes refer to:
82*cdf0e10cSrcweir'   excel_res.bas and common_res.bas
83*cdf0e10cSrcweir'
84*cdf0e10cSrcweir' For complete list of all CID_... for Issue Categories(IssueID) and
85*cdf0e10cSrcweir' CSTR_... for XML Issues (IssueTypeXML) and XML SubIssues (SubTypeXML) refer to:
86*cdf0e10cSrcweir'   ApplicationSpecific.bas and CommonMigrationAnalyser.bas
87*cdf0e10cSrcweir'
88*cdf0e10cSrcweir' You should not have to add any new Issue Categories or matching IssueTypes, only new SubIssues
89*cdf0e10cSrcweirSub Analyze_SKELETON()
90*cdf0e10cSrcweir    On Error GoTo HandleErrors
91*cdf0e10cSrcweir    Dim currentFunctionName As String
92*cdf0e10cSrcweir    currentFunctionName = "Analyze_SKELETON"
93*cdf0e10cSrcweir    Dim myIssue As IssueInfo
94*cdf0e10cSrcweir    Set myIssue = New IssueInfo
95*cdf0e10cSrcweir
96*cdf0e10cSrcweir    With myIssue
97*cdf0e10cSrcweir        .IssueID = CID_VBA_MACROS 'Issue Category
98*cdf0e10cSrcweir        .IssueType = RID_STR_COMMON_ISSUE_VBA_MACROS 'Issue String
99*cdf0e10cSrcweir        .SubType = RID_STR_COMMON_SUBISSUE_PROPERTIES 'SubIssue String
100*cdf0e10cSrcweir        .Location = .CLocationDocument 'Location string
101*cdf0e10cSrcweir
102*cdf0e10cSrcweir        .IssueTypeXML = CSTR_ISSUE_VBA_MACROS 'Non localised XML Issue String
103*cdf0e10cSrcweir        .SubTypeXML = CSTR_SUBISSUE_PROPERTIES 'Non localised XML SubIssue String
104*cdf0e10cSrcweir        .locationXML = .CXMLLocationDocument 'Non localised XML location
105*cdf0e10cSrcweir
106*cdf0e10cSrcweir        .SubLocation = 0 'if not set will default to RID_STR_NOT_AVAILABLE_SHORTHAND
107*cdf0e10cSrcweir        .Line = 0 'if not set will default to RID_STR_NOT_AVAILABLE_SHORTHAND
108*cdf0e10cSrcweir        .column = 0 'if not set will default to RID_STR_NOT_AVAILABLE_SHORTHAND
109*cdf0e10cSrcweir
110*cdf0e10cSrcweir        ' Add as many Attribute Value pairs as needed
111*cdf0e10cSrcweir        ' Note: following must always be true - Attributes.Count = Values.Count
112*cdf0e10cSrcweir        .Attributes.Add "AAA"
113*cdf0e10cSrcweir        .Values.Add "foobar"
114*cdf0e10cSrcweir
115*cdf0e10cSrcweir        ' Use AddIssueDetailsNote to add notes to the Issue Details if required
116*cdf0e10cSrcweir        ' Public Sub AddIssueDetailsNote(myIssue As IssueInfo, noteNum As Long, noteStr As String, _
117*cdf0e10cSrcweir        '   Optional preStr As String = RID_STR_COMMON_NOTE_PRE)
118*cdf0e10cSrcweir        ' Where preStr is prepended to the output, with "Note" as the default
119*cdf0e10cSrcweir         AddIssueDetailsNote myIssue, 0, RID_STR_COMMON_NOTE_DOCUMENT_PROPERTIES_LOST
120*cdf0e10cSrcweir
121*cdf0e10cSrcweir         mAnalysis.IssuesCountArray(CID_VBA_MACROS) = _
122*cdf0e10cSrcweir                mAnalysis.IssuesCountArray(CID_VBA_MACROS) + 1
123*cdf0e10cSrcweir    End With
124*cdf0e10cSrcweir
125*cdf0e10cSrcweir    mAnalysis.Issues.Add myIssue
126*cdf0e10cSrcweir
127*cdf0e10cSrcweirFinalExit:
128*cdf0e10cSrcweir    Set myIssue = Nothing
129*cdf0e10cSrcweir    Exit Sub
130*cdf0e10cSrcweir
131*cdf0e10cSrcweirHandleErrors:
132*cdf0e10cSrcweir    WriteDebug currentFunctionName & " : " & mAnalysis.name & ": " & Err.Number & " " & Err.Description & " " & Err.Source
133*cdf0e10cSrcweir    Resume FinalExit
134*cdf0e10cSrcweirEnd Sub
135*cdf0e10cSrcweir
136*cdf0e10cSrcweirSub DoAnalyse(fileName As String, userFormTypesDict As Scripting.Dictionary, _
137*cdf0e10cSrcweir    startDir As String, storeToDir As String, fso As FileSystemObject)
138*cdf0e10cSrcweir    On Error GoTo HandleErrors
139*cdf0e10cSrcweir    Dim currentFunctionName As String
140*cdf0e10cSrcweir    currentFunctionName = "DoAnalyse"
141*cdf0e10cSrcweir    'Dim secAutomation As MsoAutomationSecurity
142*cdf0e10cSrcweir    'secAutomation = Application.AutomationSecurity
143*cdf0e10cSrcweir
144*cdf0e10cSrcweir    mAnalysis.name = fileName
145*cdf0e10cSrcweir    Dim aWB As Workbook
146*cdf0e10cSrcweir    mAnalysis.TotalIssueTypes = CTOTAL_CATEGORIES
147*cdf0e10cSrcweir
148*cdf0e10cSrcweir    'Make Excel run as non interactively as possible
149*cdf0e10cSrcweir    Application.EnableEvents = False
150*cdf0e10cSrcweir    Application.DisplayAlerts = False
151*cdf0e10cSrcweir    Application.Interactive = False
152*cdf0e10cSrcweir    Application.AskToUpdateLinks = False
153*cdf0e10cSrcweir    Application.EnableAnimations = False
154*cdf0e10cSrcweir    Application.EnableSound = False
155*cdf0e10cSrcweir
156*cdf0e10cSrcweir    'Only supported in Office XP and above
157*cdf0e10cSrcweir    'Application.AutomationSecurity = msoAutomationSecurityForceDisable
158*cdf0e10cSrcweir    'mFileName = fso.GetFileName(fileName)
159*cdf0e10cSrcweir    'WriteToLog "TmpDebug1", mFileName
160*cdf0e10cSrcweir
161*cdf0e10cSrcweir    Dim myPassword As String
162*cdf0e10cSrcweir
163*cdf0e10cSrcweir    myPassword = GetDefaultPassword
164*cdf0e10cSrcweir
165*cdf0e10cSrcweir    If myPassword = "" Then
166*cdf0e10cSrcweir        myPassword = "xoxoxoxoxo"
167*cdf0e10cSrcweir    End If
168*cdf0e10cSrcweir
169*cdf0e10cSrcweir    Set aWB = Workbooks.Open(fileName:=fileName, _
170*cdf0e10cSrcweir                             Password:=myPassword, _
171*cdf0e10cSrcweir                             WriteResPassword:=myPassword, _
172*cdf0e10cSrcweir                             UpdateLinks:=0)
173*cdf0e10cSrcweir
174*cdf0e10cSrcweir    'Application.AutomationSecurity = secAutomation
175*cdf0e10cSrcweir
176*cdf0e10cSrcweir    'Do Analysis
177*cdf0e10cSrcweir    Analyze_Password_Protection aWB
178*cdf0e10cSrcweir    Analyze_Workbook_Protection aWB
179*cdf0e10cSrcweir
180*cdf0e10cSrcweir    'Set Doc Properties
181*cdf0e10cSrcweir    SetDocProperties mAnalysis, aWB, fso
182*cdf0e10cSrcweir
183*cdf0e10cSrcweir    Analyze_SheetLimits aWB
184*cdf0e10cSrcweir    Analyze_SheetDisplay aWB
185*cdf0e10cSrcweir    Analyze_SheetIssues aWB
186*cdf0e10cSrcweir    Analyze_SheetCharts aWB
187*cdf0e10cSrcweir    Analyze_WorkbookVersion aWB
188*cdf0e10cSrcweir    Analyze_Macros mAnalysis, userFormTypesDict, aWB
189*cdf0e10cSrcweir
190*cdf0e10cSrcweir    ' Doc Preparation only
191*cdf0e10cSrcweir    ' Save document with any fixed issues under <storeToDir>\prepared\<source doc name>
192*cdf0e10cSrcweir    If mAnalysis.PreparableIssuesCount > 0 And CheckDoPrepare Then
193*cdf0e10cSrcweir        Dim preparedFullPath As String
194*cdf0e10cSrcweir        preparedFullPath = GetPreparedFullPath(mAnalysis.name, startDir, storeToDir, fso)
195*cdf0e10cSrcweir        If preparedFullPath <> "" Then
196*cdf0e10cSrcweir            If fso.FileExists(preparedFullPath) Then
197*cdf0e10cSrcweir                fso.DeleteFile preparedFullPath, True
198*cdf0e10cSrcweir            End If
199*cdf0e10cSrcweir            If fso.FolderExists(fso.GetParentFolderName(preparedFullPath)) Then
200*cdf0e10cSrcweir                If IsOldVersion(aWB.FileFormat) Then
201*cdf0e10cSrcweir                    aWB.SaveAs fileName:=preparedFullPath, FileFormat:=xlExcel9795
202*cdf0e10cSrcweir                Else
203*cdf0e10cSrcweir                    aWB.SaveAs preparedFullPath
204*cdf0e10cSrcweir                End If
205*cdf0e10cSrcweir            End If
206*cdf0e10cSrcweir        End If
207*cdf0e10cSrcweir    End If
208*cdf0e10cSrcweir
209*cdf0e10cSrcweirFinalExit:
210*cdf0e10cSrcweir    If Not aWB Is Nothing Then
211*cdf0e10cSrcweir        aWB.Close (False)
212*cdf0e10cSrcweir    End If
213*cdf0e10cSrcweir
214*cdf0e10cSrcweir    Set aWB = Nothing
215*cdf0e10cSrcweir
216*cdf0e10cSrcweir    Application.EnableEvents = True
217*cdf0e10cSrcweir    Application.DisplayAlerts = True
218*cdf0e10cSrcweir    Application.Interactive = True
219*cdf0e10cSrcweir    Application.AskToUpdateLinks = True
220*cdf0e10cSrcweir    Application.EnableAnimations = True
221*cdf0e10cSrcweir    Application.EnableSound = True
222*cdf0e10cSrcweir
223*cdf0e10cSrcweir    'Debug - Call Sleep(5000)
224*cdf0e10cSrcweir    Exit Sub
225*cdf0e10cSrcweir
226*cdf0e10cSrcweirHandleErrors:
227*cdf0e10cSrcweir    ' MsgBox currentFunctionName & " : " & fileName & ": " & Err.Number & " " & Err.Description & " " & Err.Source
228*cdf0e10cSrcweir    ' Handle Password error on Doc Open, Modify and Cancel
229*cdf0e10cSrcweir    If Err.Number = 1004 Then
230*cdf0e10cSrcweir        WriteDebug currentFunctionName & " : " & fileName & ": " & _
231*cdf0e10cSrcweir          "User entered Invalid Document Password - " & Err.Number & " " & Err.Description & " " & Err.Source
232*cdf0e10cSrcweir        HandleProtectedDocInvalidPassword mAnalysis, _
233*cdf0e10cSrcweir            "User entered Invalid Document Password, further analysis not possible", fso
234*cdf0e10cSrcweir        Resume FinalExit
235*cdf0e10cSrcweir    End If
236*cdf0e10cSrcweir    mAnalysis.Application = RID_STR_COMMON_CANNOT_OPEN
237*cdf0e10cSrcweir    WriteDebug currentFunctionName & " : " & fileName & ": " & Err.Number & " " & Err.Description & " " & Err.Source
238*cdf0e10cSrcweir    Resume FinalExit
239*cdf0e10cSrcweirEnd Sub
240*cdf0e10cSrcweir
241*cdf0e10cSrcweirSub Analyze_SheetCharts(aWB As Workbook)
242*cdf0e10cSrcweir    On Error GoTo HandleErrors
243*cdf0e10cSrcweir    Dim currentFunctionName As String
244*cdf0e10cSrcweir    currentFunctionName = "Analyze_SheetCharts"
245*cdf0e10cSrcweir
246*cdf0e10cSrcweir    Dim myChartSheet As Chart
247*cdf0e10cSrcweir
248*cdf0e10cSrcweir    For Each myChartSheet In aWB.Charts
249*cdf0e10cSrcweir        SetChartIssueMinor myChartSheet, myChartSheet.name, False
250*cdf0e10cSrcweir        SetChartIssueComplex myChartSheet, myChartSheet.name
251*cdf0e10cSrcweir    Next myChartSheet
252*cdf0e10cSrcweir
253*cdf0e10cSrcweir    Exit Sub
254*cdf0e10cSrcweirHandleErrors:
255*cdf0e10cSrcweir    WriteDebug currentFunctionName & " : " & mAnalysis.name & ": " & Err.Number & " " & Err.Description & " " & Err.Source
256*cdf0e10cSrcweirEnd Sub
257*cdf0e10cSrcweir
258*cdf0e10cSrcweirSub Analyze_EmbeddedCharts(mySheet As Worksheet)
259*cdf0e10cSrcweir    On Error GoTo HandleErrors
260*cdf0e10cSrcweir    Dim currentFunctionName As String
261*cdf0e10cSrcweir    currentFunctionName = "Analyze_EmbeddedCharts"
262*cdf0e10cSrcweir    Dim BorderIssue As Boolean
263*cdf0e10cSrcweir
264*cdf0e10cSrcweir    Dim index As Integer
265*cdf0e10cSrcweir    BorderIssue = False
266*cdf0e10cSrcweir    Dim chartcount As Integer
267*cdf0e10cSrcweir    Dim myChart As Chart
268*cdf0e10cSrcweir
269*cdf0e10cSrcweir    chartcount = mySheet.ChartObjects.count
270*cdf0e10cSrcweir
271*cdf0e10cSrcweir    For index = 1 To chartcount
272*cdf0e10cSrcweir        BorderIssue = False
273*cdf0e10cSrcweir        With mySheet.ChartObjects(index)
274*cdf0e10cSrcweir            If .Border.LineStyle <> xlLineStyleNone Then
275*cdf0e10cSrcweir                BorderIssue = True
276*cdf0e10cSrcweir            End If
277*cdf0e10cSrcweir            SetChartIssueMinor .Chart, mySheet.name, BorderIssue
278*cdf0e10cSrcweir            'If Not ((.ChartType = xlSurface) _
279*cdf0e10cSrcweir            '    And (.ChartType = xlSurfaceTopViewWireframe) _
280*cdf0e10cSrcweir            '    And (.ChartType = xlSurfaceTopView)) Then
281*cdf0e10cSrcweir                SetChartIssueComplex .Chart, mySheet.name
282*cdf0e10cSrcweir            'End If
283*cdf0e10cSrcweir        End With
284*cdf0e10cSrcweir    Next index
285*cdf0e10cSrcweir
286*cdf0e10cSrcweir    Exit Sub
287*cdf0e10cSrcweirHandleErrors:
288*cdf0e10cSrcweir    WriteDebug currentFunctionName & " : " & mAnalysis.name & ": " & Err.Number & " " & Err.Description & " " & Err.Source
289*cdf0e10cSrcweirEnd Sub
290*cdf0e10cSrcweir
291*cdf0e10cSrcweirPrivate Function getType(o As Variant) As Integer
292*cdf0e10cSrcweir    If (VarType(o) = vbString) Then
293*cdf0e10cSrcweir        Dim aDataSource As String
294*cdf0e10cSrcweir        aDataSource = o
295*cdf0e10cSrcweir        getType = DATA_SOURCE_EXCEL
296*cdf0e10cSrcweir        If (Len(aDataSource) > 0) Then
297*cdf0e10cSrcweir            Dim nBackslashPos As Long
298*cdf0e10cSrcweir            nBackslashPos = InStr(Trim(aDataSource), "\")
299*cdf0e10cSrcweir            If (nBackslashPos > 0 And nBackslashPos < 4) Then
300*cdf0e10cSrcweir                getType = DATA_SOURCE_EXTERNAL_FILE
301*cdf0e10cSrcweir            End If
302*cdf0e10cSrcweir        End If
303*cdf0e10cSrcweir    ElseIf (IsArray(o)) Then
304*cdf0e10cSrcweir        If (hasSecondDimension(o)) Then
305*cdf0e10cSrcweir            getType = DATA_SOURCE_MULTIPLE
306*cdf0e10cSrcweir        Else
307*cdf0e10cSrcweir            getType = DATA_SOURCE_EXTERNAL
308*cdf0e10cSrcweir        End If
309*cdf0e10cSrcweir    End If
310*cdf0e10cSrcweirEnd Function
311*cdf0e10cSrcweir
312*cdf0e10cSrcweirPrivate Function hasSecondDimension(o2 As Variant) As Boolean
313*cdf0e10cSrcweir    On Error GoTo njet
314*cdf0e10cSrcweir    Dim temp As Integer
315*cdf0e10cSrcweir    temp = UBound(o2, 2)
316*cdf0e10cSrcweir    hasSecondDimension = True
317*cdf0e10cSrcweir    Exit Function
318*cdf0e10cSrcweirnjet:
319*cdf0e10cSrcweir    hasSecondDimension = False
320*cdf0e10cSrcweirEnd Function
321*cdf0e10cSrcweir
322*cdf0e10cSrcweirPrivate Sub Analyze_PivotTable(myIssue As IssueInfo, myPivotTable As PivotTable)
323*cdf0e10cSrcweir    On Error GoTo HandleErrors
324*cdf0e10cSrcweir    Dim currentFunctionName As String
325*cdf0e10cSrcweir    currentFunctionName = "Analyse_PivotTable"
326*cdf0e10cSrcweir
327*cdf0e10cSrcweir    Dim aPivotField As PivotField
328*cdf0e10cSrcweir    Dim aNoteCount As Long
329*cdf0e10cSrcweir    Dim bManualSort As Boolean
330*cdf0e10cSrcweir    Dim bCalculatedValues As Boolean
331*cdf0e10cSrcweir    Dim aSorting As XlSortOrder
332*cdf0e10cSrcweir    Dim nCount As Integer
333*cdf0e10cSrcweir    Dim nDataSource As Integer
334*cdf0e10cSrcweir
335*cdf0e10cSrcweir    bManualSort = False
336*cdf0e10cSrcweir    bCalculatedValues = False
337*cdf0e10cSrcweir
338*cdf0e10cSrcweir    For Each aPivotField In myPivotTable.PivotFields
339*cdf0e10cSrcweir        aSorting = xlAscending
340*cdf0e10cSrcweir
341*cdf0e10cSrcweir        On Error Resume Next 'some fields don't have any property at all
342*cdf0e10cSrcweir        aSorting = aPivotField.AutoSortOrder
343*cdf0e10cSrcweir        On Error GoTo HandleErrors
344*cdf0e10cSrcweir
345*cdf0e10cSrcweir        If (aSorting = xlManual) Then
346*cdf0e10cSrcweir            bManualSort = True
347*cdf0e10cSrcweir        End If
348*cdf0e10cSrcweir
349*cdf0e10cSrcweir        nCount = 0
350*cdf0e10cSrcweir
351*cdf0e10cSrcweir        On Error Resume Next 'some fields don't have any property at all
352*cdf0e10cSrcweir        nCount = aPivotField.CalculatedItems.count
353*cdf0e10cSrcweir        On Error GoTo HandleErrors
354*cdf0e10cSrcweir
355*cdf0e10cSrcweir        If (nCount > 0) Then
356*cdf0e10cSrcweir            bCalculatedValues = True
357*cdf0e10cSrcweir        End If
358*cdf0e10cSrcweir    Next
359*cdf0e10cSrcweir
360*cdf0e10cSrcweir    nCount = 0
361*cdf0e10cSrcweir
362*cdf0e10cSrcweir    On Error Resume Next 'some fields don't have any property at all
363*cdf0e10cSrcweir    nCount = myPivotTable.CalculatedFields.count
364*cdf0e10cSrcweir    On Error GoTo HandleErrors
365*cdf0e10cSrcweir
366*cdf0e10cSrcweir    If (nCount > 0) Then
367*cdf0e10cSrcweir        bCalculatedValues = True
368*cdf0e10cSrcweir    End If
369*cdf0e10cSrcweir
370*cdf0e10cSrcweir    nDataSource = getType(myPivotTable.SourceData)
371*cdf0e10cSrcweir
372*cdf0e10cSrcweir    aNoteCount = 0
373*cdf0e10cSrcweir
374*cdf0e10cSrcweir    If (bManualSort) Then
375*cdf0e10cSrcweir        AddIssueDetailsNote myIssue, aNoteCount, RID_RESXLT_COST_PIVOT_ManSort_Comment
376*cdf0e10cSrcweir        aNoteCount = aNoteCount + 1
377*cdf0e10cSrcweir    End If
378*cdf0e10cSrcweir
379*cdf0e10cSrcweir    If (nDataSource = DATA_SOURCE_EXTERNAL) Then
380*cdf0e10cSrcweir        AddIssueDetailsNote myIssue, aNoteCount, RID_RESXLT_COST_PIVOT_ExternData_Comment
381*cdf0e10cSrcweir        aNoteCount = aNoteCount + 1
382*cdf0e10cSrcweir    ElseIf (nDataSource = DATA_SOURCE_MULTIPLE) Then
383*cdf0e10cSrcweir        AddIssueDetailsNote myIssue, aNoteCount, RID_RESXLT_COST_PIVOT_MultConsRanges_Comment
384*cdf0e10cSrcweir        aNoteCount = aNoteCount + 1
385*cdf0e10cSrcweir    ElseIf (nDataSource = DATA_SOURCE_EXTERNAL_FILE) Then
386*cdf0e10cSrcweir        Dim noteString As String
387*cdf0e10cSrcweir        noteString = RID_RESXLT_COST_PIVOT_ExternData_Comment & "[" & _
388*cdf0e10cSrcweir                     myPivotTable.SourceData & "]"
389*cdf0e10cSrcweir        AddIssueDetailsNote myIssue, aNoteCount, noteString
390*cdf0e10cSrcweir        aNoteCount = aNoteCount + 1
391*cdf0e10cSrcweir    End If
392*cdf0e10cSrcweir
393*cdf0e10cSrcweir    If (bCalculatedValues) Then
394*cdf0e10cSrcweir        AddIssueDetailsNote myIssue, aNoteCount, RID_RESXLT_COST_PIVOT_CalcVal_Comment
395*cdf0e10cSrcweir        aNoteCount = aNoteCount + 1
396*cdf0e10cSrcweir    End If
397*cdf0e10cSrcweir
398*cdf0e10cSrcweirFinalExit:
399*cdf0e10cSrcweir    Exit Sub
400*cdf0e10cSrcweir
401*cdf0e10cSrcweirHandleErrors:
402*cdf0e10cSrcweir    WriteDebug currentFunctionName & " : " & mAnalysis.name & ": " & Err.Number & " " & Err.Description & " " & Err.Source
403*cdf0e10cSrcweir    Resume FinalExit
404*cdf0e10cSrcweirEnd Sub
405*cdf0e10cSrcweir
406*cdf0e10cSrcweirPrivate Sub SetChartIssueComplex(myChart As Chart, myName As String)
407*cdf0e10cSrcweir    On Error GoTo HandleErrors
408*cdf0e10cSrcweir    Dim currentFunctionName As String
409*cdf0e10cSrcweir    currentFunctionName = "SetChartIssueComplex"
410*cdf0e10cSrcweir
411*cdf0e10cSrcweir    Dim myIssue As IssueInfo
412*cdf0e10cSrcweir    Dim bSeriesChartTypeChanged As Boolean
413*cdf0e10cSrcweir    Dim bDatasourceNotLinkedtoCell As Boolean
414*cdf0e10cSrcweir    Dim bDatasourceOnDifferentSheet As Boolean
415*cdf0e10cSrcweir    Dim bCategoryandValue As Boolean
416*cdf0e10cSrcweir    Dim bCLabelMorethanOneCell As Boolean
417*cdf0e10cSrcweir    Dim bOneColumnRow As Boolean
418*cdf0e10cSrcweir    Dim bDataTable As Boolean
419*cdf0e10cSrcweir    Dim bXAxes As Boolean
420*cdf0e10cSrcweir    Dim bseries As Boolean
421*cdf0e10cSrcweir    Dim bformat As Boolean
422*cdf0e10cSrcweir    Dim bpivot As Boolean
423*cdf0e10cSrcweir
424*cdf0e10cSrcweir
425*cdf0e10cSrcweir    Set myIssue = New IssueInfo
426*cdf0e10cSrcweir    bSeriesChartTypeChanged = False
427*cdf0e10cSrcweir    bDatasourceNotLinkedtoCell = False
428*cdf0e10cSrcweir    bDatasourceOnDifferentSheet = False
429*cdf0e10cSrcweir    bCategoryandValue = False
430*cdf0e10cSrcweir    bCLabelMorethanOneCell = False
431*cdf0e10cSrcweir    bOneColumnRow = False
432*cdf0e10cSrcweir    bDataTable = False
433*cdf0e10cSrcweir    bXAxes = False
434*cdf0e10cSrcweir
435*cdf0e10cSrcweir    bformat = FormatIssueComplex(myChart, bDataTable, bXAxes)
436*cdf0e10cSrcweir    bseries = SeriesIssue(myChart, bSeriesChartTypeChanged, bDatasourceNotLinkedtoCell, bDatasourceOnDifferentSheet, bCategoryandValue, bCLabelMorethanOneCell, bOneColumnRow)
437*cdf0e10cSrcweir    bpivot = Not (myChart.PivotLayout Is Nothing)
438*cdf0e10cSrcweir
439*cdf0e10cSrcweir    If (Not (bseries Or bformat Or bpivot)) Then
440*cdf0e10cSrcweir        GoTo FinalExit
441*cdf0e10cSrcweir    ElseIf bpivot Then
442*cdf0e10cSrcweir        With myIssue
443*cdf0e10cSrcweir            .IssueID = CID_CHARTS_TABLES
444*cdf0e10cSrcweir            .IssueType = RID_STR_EXCEL_ISSUE_CHARTS_AND_TABLES
445*cdf0e10cSrcweir            .SubType = RID_STR_EXCEL_SUBISSUE_PIVOT
446*cdf0e10cSrcweir            .Location = .CLocationSheet
447*cdf0e10cSrcweir            .SubLocation = myName
448*cdf0e10cSrcweir
449*cdf0e10cSrcweir            .IssueTypeXML = CSTR_ISSUE_CHARTS_TABLES
450*cdf0e10cSrcweir            .SubTypeXML = CSTR_SUBISSUE_CHART_PIVOT
451*cdf0e10cSrcweir            .locationXML = .CXMLLocationSheet
452*cdf0e10cSrcweir            .Attributes.Add RID_STR_EXCEL_ATTRIBUTE_PIVOT_TABLE_NAME
453*cdf0e10cSrcweir            .Values.Add myChart.PivotLayout.PivotTable.name
454*cdf0e10cSrcweir            .Attributes.Add RID_STR_EXCEL_ATTRIBUTE_PIVOT_FIELDS_VISIBLE
455*cdf0e10cSrcweir            .Values.Add myChart.HasPivotFields
456*cdf0e10cSrcweir            .Attributes.Add RID_STR_EXCEL_ATTRIBUTE_PIVOT_FIELDS_NUM
457*cdf0e10cSrcweir            .Values.Add myChart.PivotLayout.PivotTable.PivotFields.count
458*cdf0e10cSrcweir            .Attributes.Add RID_STR_EXCEL_ATTRIBUTE_TYPE
459*cdf0e10cSrcweir            .Values.Add getChartTypeAsString(myChart.ChartType)
460*cdf0e10cSrcweir            .Attributes.Add RID_STR_EXCEL_ATTRIBUTE_CHARTNAME
461*cdf0e10cSrcweir            .Values.Add myChart.name
462*cdf0e10cSrcweir        End With
463*cdf0e10cSrcweir
464*cdf0e10cSrcweir        AddIssueDetailsNote myIssue, 0, RID_RESXLT_COST_PIVOT_PivotChart_Comment
465*cdf0e10cSrcweir        mAnalysis.IssuesCountArray(CID_CHARTS_TABLES) = _
466*cdf0e10cSrcweir            mAnalysis.IssuesCountArray(CID_CHARTS_TABLES) + 1
467*cdf0e10cSrcweir        mAnalysis.Issues.Add myIssue
468*cdf0e10cSrcweir
469*cdf0e10cSrcweir        GoTo FinalExit
470*cdf0e10cSrcweir    Else
471*cdf0e10cSrcweir        With myIssue
472*cdf0e10cSrcweir            Dim NoteIndex As Long
473*cdf0e10cSrcweir            NoteIndex = 0
474*cdf0e10cSrcweir
475*cdf0e10cSrcweir            .IssueID = CID_CHARTS_TABLES
476*cdf0e10cSrcweir            .IssueType = RID_STR_EXCEL_ISSUE_CHARTS_AND_TABLES
477*cdf0e10cSrcweir            .SubType = RID_STR_EXCEL_SUBISSUE_CHART_COMPLEX
478*cdf0e10cSrcweir            .Location = .CLocationSheet
479*cdf0e10cSrcweir            .SubLocation = myName
480*cdf0e10cSrcweir
481*cdf0e10cSrcweir            .IssueTypeXML = CSTR_ISSUE_CHARTS_TABLES
482*cdf0e10cSrcweir            .SubTypeXML = CSTR_SUBISSUE_CHART_COMPLEX
483*cdf0e10cSrcweir            .locationXML = .CXMLLocationSheet
484*cdf0e10cSrcweir
485*cdf0e10cSrcweir            If bDataTable Then
486*cdf0e10cSrcweir                .Attributes.Add RID_STR_EXCEL_ATTRIBUTE_DATATABLE
487*cdf0e10cSrcweir                .Values.Add RID_STR_EXCEL_ATTRIBUTE_SET
488*cdf0e10cSrcweir                AddIssueDetailsNote myIssue, NoteIndex, RID_STR_EXCEL_NOTE_DATATABLE
489*cdf0e10cSrcweir                NoteIndex = NoteIndex + 1
490*cdf0e10cSrcweir            End If
491*cdf0e10cSrcweir            If bXAxes Then
492*cdf0e10cSrcweir                .Attributes.Add RID_STR_EXCEL_ATTRIBUTE_XAXISCATEGORY
493*cdf0e10cSrcweir                .Values.Add RID_STR_EXCEL_ATTRIBUTE_TIMESCALE
494*cdf0e10cSrcweir                AddIssueDetailsNote myIssue, NoteIndex, RID_STR_EXCEL_NOTE_XAXISCATEGORY
495*cdf0e10cSrcweir                NoteIndex = NoteIndex + 1
496*cdf0e10cSrcweir            End If
497*cdf0e10cSrcweir            If bSeriesChartTypeChanged Then
498*cdf0e10cSrcweir                .Attributes.Add RID_STR_EXCEL_ATTRIBUTE_SERIESCHARTTYPE
499*cdf0e10cSrcweir                .Values.Add RID_STR_EXCEL_ATTRIBUTE_CHANGED
500*cdf0e10cSrcweir                AddIssueDetailsNote myIssue, NoteIndex, RID_STR_EXCEL_NOTE_SERIESCHARTTYPE
501*cdf0e10cSrcweir                NoteIndex = NoteIndex + 1
502*cdf0e10cSrcweir            End If
503*cdf0e10cSrcweir            If bDatasourceNotLinkedtoCell Then
504*cdf0e10cSrcweir                .Attributes.Add RID_STR_EXCEL_ATTRIBUTE_DATASOURCE
505*cdf0e10cSrcweir                .Values.Add RID_STR_EXCEL_ATTRIBUTE_DATASOURCENOTLINKEDTOCELL
506*cdf0e10cSrcweir                AddIssueDetailsNote myIssue, NoteIndex, RID_STR_EXCEL_NOTE_DATASOURCENOTLINKEDTOCELL
507*cdf0e10cSrcweir                NoteIndex = NoteIndex + 1
508*cdf0e10cSrcweir            End If
509*cdf0e10cSrcweir            If bDatasourceOnDifferentSheet Then
510*cdf0e10cSrcweir                .Attributes.Add RID_STR_EXCEL_ATTRIBUTE_DATASOURCE
511*cdf0e10cSrcweir                .Values.Add RID_STR_EXCEL_ATTRIBUTE_DATASOURCEONDIFFERENTSHEET
512*cdf0e10cSrcweir                AddIssueDetailsNote myIssue, NoteIndex, RID_STR_EXCEL_NOTE_DATASOURCEONDIFFERENTSHEET
513*cdf0e10cSrcweir                NoteIndex = NoteIndex + 1
514*cdf0e10cSrcweir            End If
515*cdf0e10cSrcweir            If bCategoryandValue Then
516*cdf0e10cSrcweir                .Attributes.Add RID_STR_EXCEL_ATTRIBUTE_CATEGORYANDDATA
517*cdf0e10cSrcweir                .Values.Add RID_STR_EXCEL_ATTRIBUTE_SEPARATE
518*cdf0e10cSrcweir                AddIssueDetailsNote myIssue, NoteIndex, RID_STR_EXCEL_NOTE_CATEGORYANDDATA
519*cdf0e10cSrcweir                NoteIndex = NoteIndex + 1
520*cdf0e10cSrcweir            End If
521*cdf0e10cSrcweir            If bCLabelMorethanOneCell Then
522*cdf0e10cSrcweir                .Attributes.Add RID_STR_EXCEL_ATTRIBUTE_CATEGORYLABEL
523*cdf0e10cSrcweir                .Values.Add RID_STR_EXCEL_ATTRIBUTE_CATEGORYLABELMORETHANONECELL
524*cdf0e10cSrcweir                AddIssueDetailsNote myIssue, NoteIndex, RID_STR_EXCEL_NOTE_CATEGORYLABELMORETHANONECELL
525*cdf0e10cSrcweir                NoteIndex = NoteIndex + 1
526*cdf0e10cSrcweir            End If
527*cdf0e10cSrcweir            If bOneColumnRow Then
528*cdf0e10cSrcweir                .Attributes.Add RID_STR_EXCEL_ATTRIBUTE_COLUMNBAR
529*cdf0e10cSrcweir                .Values.Add RID_STR_EXCEL_ATTRIBUTE_ONECOLUMNROW
530*cdf0e10cSrcweir                AddIssueDetailsNote myIssue, NoteIndex, RID_STR_EXCEL_NOTE_COLUMNBAR
531*cdf0e10cSrcweir                NoteIndex = NoteIndex + 1
532*cdf0e10cSrcweir            End If
533*cdf0e10cSrcweir            .Attributes.Add RID_STR_EXCEL_ATTRIBUTE_TYPE
534*cdf0e10cSrcweir            .Values.Add getChartTypeAsString(myChart.ChartType)
535*cdf0e10cSrcweir            .Attributes.Add RID_STR_EXCEL_ATTRIBUTE_CHARTNAME
536*cdf0e10cSrcweir            .Values.Add myChart.name
537*cdf0e10cSrcweir        End With
538*cdf0e10cSrcweir
539*cdf0e10cSrcweir        mAnalysis.IssuesCountArray(CID_CHARTS_TABLES) = _
540*cdf0e10cSrcweir            mAnalysis.IssuesCountArray(CID_CHARTS_TABLES) + 1
541*cdf0e10cSrcweir        mAnalysis.Issues.Add myIssue
542*cdf0e10cSrcweir    End If
543*cdf0e10cSrcweirFinalExit:
544*cdf0e10cSrcweir    Set myIssue = Nothing
545*cdf0e10cSrcweir    Exit Sub
546*cdf0e10cSrcweir
547*cdf0e10cSrcweirHandleErrors:
548*cdf0e10cSrcweir    WriteDebug currentFunctionName & " : " & mAnalysis.name & ": " & Err.Number & " " & Err.Description & " " & Err.Source
549*cdf0e10cSrcweir    Resume FinalExit
550*cdf0e10cSrcweirEnd Sub
551*cdf0e10cSrcweir
552*cdf0e10cSrcweirPrivate Sub SetChartIssueMinor(myChart As Chart, myName As String, BorderIssue As Boolean)
553*cdf0e10cSrcweir    On Error GoTo HandleErrors
554*cdf0e10cSrcweir    Dim currentFunctionName As String
555*cdf0e10cSrcweir    currentFunctionName = "SetChartIssueMinor"
556*cdf0e10cSrcweir
557*cdf0e10cSrcweir    Dim myIssue As IssueInfo
558*cdf0e10cSrcweir    Dim bUnsupportedType As Boolean
559*cdf0e10cSrcweir    Dim bTrendline As Boolean
560*cdf0e10cSrcweir    Dim bDatalabelWithLegend As Boolean
561*cdf0e10cSrcweir    Dim bLegendPosition As Boolean
562*cdf0e10cSrcweir    Dim bTitleFont As Boolean
563*cdf0e10cSrcweir    Dim bPiechartDirection As Boolean
564*cdf0e10cSrcweir    Dim bAxisInterval As Boolean
565*cdf0e10cSrcweir
566*cdf0e10cSrcweir
567*cdf0e10cSrcweir    Set myIssue = New IssueInfo
568*cdf0e10cSrcweir    bUnsupportedType = False
569*cdf0e10cSrcweir    bTrendline = False
570*cdf0e10cSrcweir    bDatalabelWithLegend = False
571*cdf0e10cSrcweir    bLegendPosition = False
572*cdf0e10cSrcweir    bTitleFont = False
573*cdf0e10cSrcweir    bPiechartDirection = False
574*cdf0e10cSrcweir    bAxisInterval = False
575*cdf0e10cSrcweir
576*cdf0e10cSrcweir
577*cdf0e10cSrcweir    If (Not FormatissueMinor(myChart, bUnsupportedType, bTrendline, bDatalabelWithLegend, bLegendPosition, bTitleFont, bPiechartDirection, bAxisInterval)) And (Not BorderIssue) Then
578*cdf0e10cSrcweir        GoTo FinalExit
579*cdf0e10cSrcweir    Else
580*cdf0e10cSrcweir        With myIssue
581*cdf0e10cSrcweir            Dim NoteIndex As Long
582*cdf0e10cSrcweir            NoteIndex = 0
583*cdf0e10cSrcweir
584*cdf0e10cSrcweir            .IssueID = CID_CHARTS_TABLES
585*cdf0e10cSrcweir            .IssueType = RID_STR_EXCEL_ISSUE_CHARTS_AND_TABLES
586*cdf0e10cSrcweir
587*cdf0e10cSrcweir            .SubType = RID_STR_EXCEL_SUBISSUE_CHART_MINOR
588*cdf0e10cSrcweir            .Location = .CLocationSheet
589*cdf0e10cSrcweir            .SubLocation = myName
590*cdf0e10cSrcweir
591*cdf0e10cSrcweir            .IssueTypeXML = CSTR_ISSUE_CHARTS_TABLES
592*cdf0e10cSrcweir            .SubTypeXML = CSTR_SUBISSUE_CHART_PIVOT
593*cdf0e10cSrcweir            .locationXML = .CXMLLocationSheet
594*cdf0e10cSrcweir
595*cdf0e10cSrcweir            If bUnsupportedType Then
596*cdf0e10cSrcweir                .Attributes.Add RID_STR_EXCEL_ATTRIBUTE_UNSUPPORTEDTYPE
597*cdf0e10cSrcweir                .Values.Add getChartTypeAsString(myChart.ChartType)
598*cdf0e10cSrcweir                ' bubble chart
599*cdf0e10cSrcweir                If (myChart.ChartType = xlBubble Or myChart.ChartType = xlBubble3DEffect) Then
600*cdf0e10cSrcweir                    AddIssueDetailsNote myIssue, NoteIndex, RID_RESXLT_COST_CHART_Bubble_Comment
601*cdf0e10cSrcweir                ' bar of pie and pie of pie chart
602*cdf0e10cSrcweir                ElseIf (myChart.ChartType = xlPieOfPie Or myChart.ChartType = xlBarOfPie) Then
603*cdf0e10cSrcweir                    AddIssueDetailsNote myIssue, NoteIndex, RID_RESXLT_COST_CHART_BarOfPie_Comment
604*cdf0e10cSrcweir                ' Scatter chart
605*cdf0e10cSrcweir                ElseIf (myChart.ChartType = xlXYScatter Or myChart.ChartType = xlXYScatterLines _
606*cdf0e10cSrcweir                        Or myChart.ChartType = xlXYScatterLinesNoMarkers _
607*cdf0e10cSrcweir                        Or myChart.ChartType = xlXYScatterSmooth _
608*cdf0e10cSrcweir                        Or myChart.ChartType = xlXYScatterSmoothNoMarkers) Then
609*cdf0e10cSrcweir                    AddIssueDetailsNote myIssue, NoteIndex, RID_RESXLT_COST_CHART_Scattered_Comment
610*cdf0e10cSrcweir                ' radar chart
611*cdf0e10cSrcweir                ElseIf (myChart.ChartType = xlRadarMarkers Or myChart.ChartType = xlRadar) Then
612*cdf0e10cSrcweir                    AddIssueDetailsNote myIssue, NoteIndex, RID_RESXLT_COST_CHART_Radar_Comment
613*cdf0e10cSrcweir                ' radar filled chart
614*cdf0e10cSrcweir                ElseIf (myChart.ChartType = xlRadarFilled) Then
615*cdf0e10cSrcweir                    AddIssueDetailsNote myIssue, NoteIndex, RID_RESXLT_COST_CHART_FilledRadar_Comment
616*cdf0e10cSrcweir                ' surface chart
617*cdf0e10cSrcweir                ElseIf (myChart.ChartType = xlSurface Or myChart.ChartType = xlSurfaceTopView _
618*cdf0e10cSrcweir                        Or myChart.ChartType = xlSurfaceTopViewWireframe _
619*cdf0e10cSrcweir                        Or myChart.ChartType = xlSurfaceWireframe) Then
620*cdf0e10cSrcweir                    AddIssueDetailsNote myIssue, NoteIndex, RID_RESXLT_COST_CHART_Surface_Comment
621*cdf0e10cSrcweir                Else
622*cdf0e10cSrcweir                    AddIssueDetailsNote myIssue, NoteIndex, RID_STR_EXCEL_NOTE_UNSUPPORTEDTYPE1
623*cdf0e10cSrcweir                    NoteIndex = NoteIndex + 1
624*cdf0e10cSrcweir                    AddIssueDetailsNote myIssue, NoteIndex, RID_STR_EXCEL_NOTE_UNSUPPORTEDTYPE2
625*cdf0e10cSrcweir                End If
626*cdf0e10cSrcweir                NoteIndex = NoteIndex + 1
627*cdf0e10cSrcweir            End If
628*cdf0e10cSrcweir            If bTrendline Then
629*cdf0e10cSrcweir                .Attributes.Add RID_STR_EXCEL_ATTRIBUTE_TRENDLINE
630*cdf0e10cSrcweir                .Values.Add RID_STR_EXCEL_ATTRIBUTE_SET
631*cdf0e10cSrcweir                AddIssueDetailsNote myIssue, NoteIndex, RID_STR_EXCEL_NOTE_TRENDLINE
632*cdf0e10cSrcweir                NoteIndex = NoteIndex + 1
633*cdf0e10cSrcweir            End If
634*cdf0e10cSrcweir            If bDatalabelWithLegend Then
635*cdf0e10cSrcweir                .Attributes.Add RID_STR_EXCEL_ATTRIBUTE_DATALABELWITHLEGEND
636*cdf0e10cSrcweir                .Values.Add RID_STR_EXCEL_ATTRIBUTE_SET
637*cdf0e10cSrcweir                AddIssueDetailsNote myIssue, NoteIndex, RID_STR_EXCEL_NOTE_DATALABELWITHLEGEND
638*cdf0e10cSrcweir                NoteIndex = NoteIndex + 1
639*cdf0e10cSrcweir            End If
640*cdf0e10cSrcweir            If bLegendPosition Then
641*cdf0e10cSrcweir                .Attributes.Add RID_STR_EXCEL_ATTRIBUTE_LEGENDPOSITION
642*cdf0e10cSrcweir                .Values.Add RID_STR_EXCEL_ATTRIBUTE_NOTRIGHT
643*cdf0e10cSrcweir                AddIssueDetailsNote myIssue, NoteIndex, RID_STR_EXCEL_NOTE_LEGENDPOSITION
644*cdf0e10cSrcweir                NoteIndex = NoteIndex + 1
645*cdf0e10cSrcweir            End If
646*cdf0e10cSrcweir            If bTitleFont Then
647*cdf0e10cSrcweir                .Attributes.Add RID_STR_EXCEL_ATTRIBUTE_TITLEFONT
648*cdf0e10cSrcweir                .Values.Add RID_STR_EXCEL_ATTRIBUTE_DIFFERENT
649*cdf0e10cSrcweir                AddIssueDetailsNote myIssue, NoteIndex, RID_STR_EXCEL_NOTE_TITLEFONT
650*cdf0e10cSrcweir                NoteIndex = NoteIndex + 1
651*cdf0e10cSrcweir            End If
652*cdf0e10cSrcweir            If bPiechartDirection Then
653*cdf0e10cSrcweir                .Attributes.Add RID_STR_EXCEL_ATTRIBUTE_PIE
654*cdf0e10cSrcweir                .Values.Add RID_STR_EXCEL_ATTRIBUTE_SLICES_IN_DIFFERENT_DIRECTION
655*cdf0e10cSrcweir            End If
656*cdf0e10cSrcweir            If BorderIssue Then
657*cdf0e10cSrcweir                .Attributes.Add RID_STR_EXCEL_ATTRIBUTE_BORDER
658*cdf0e10cSrcweir                .Values.Add RID_STR_EXCEL_ATTRIBUTE_SET
659*cdf0e10cSrcweir                AddIssueDetailsNote myIssue, NoteIndex, RID_STR_EXCEL_NOTE_BORDER
660*cdf0e10cSrcweir                NoteIndex = NoteIndex + 1
661*cdf0e10cSrcweir            End If
662*cdf0e10cSrcweir            If bAxisInterval Then
663*cdf0e10cSrcweir                .Attributes.Add RID_STR_EXCEL_ATTRIBUTE_AXISINTERVAL
664*cdf0e10cSrcweir                .Values.Add RID_STR_EXCEL_ATTRIBUTE_AUTO
665*cdf0e10cSrcweir                AddIssueDetailsNote myIssue, NoteIndex, RID_STR_EXCEL_NOTE_AXISINTERVAL
666*cdf0e10cSrcweir                NoteIndex = NoteIndex + 1
667*cdf0e10cSrcweir            End If
668*cdf0e10cSrcweir           .Attributes.Add RID_STR_EXCEL_ATTRIBUTE_CHARTNAME
669*cdf0e10cSrcweir            .Values.Add myChart.name
670*cdf0e10cSrcweir        End With
671*cdf0e10cSrcweir
672*cdf0e10cSrcweir        mAnalysis.IssuesCountArray(CID_CHARTS_TABLES) = _
673*cdf0e10cSrcweir            mAnalysis.IssuesCountArray(CID_CHARTS_TABLES) + 1
674*cdf0e10cSrcweir        mAnalysis.Issues.Add myIssue
675*cdf0e10cSrcweir    End If
676*cdf0e10cSrcweirFinalExit:
677*cdf0e10cSrcweir    Set myIssue = Nothing
678*cdf0e10cSrcweir    Exit Sub
679*cdf0e10cSrcweir
680*cdf0e10cSrcweirHandleErrors:
681*cdf0e10cSrcweir    WriteDebug currentFunctionName & " : " & mAnalysis.name & ": " & Err.Number & " " & Err.Description & " " & Err.Source
682*cdf0e10cSrcweir    Resume FinalExit
683*cdf0e10cSrcweirEnd Sub
684*cdf0e10cSrcweir
685*cdf0e10cSrcweirSub SetChartIssue(myChart As Chart, myName As String, strSubType As String, _
686*cdf0e10cSrcweir    strXMLSubType As String)
687*cdf0e10cSrcweir    On Error GoTo HandleErrors
688*cdf0e10cSrcweir    Dim currentFunctionName As String
689*cdf0e10cSrcweir    currentFunctionName = "SetChartIssue"
690*cdf0e10cSrcweir    Dim myIssue As IssueInfo
691*cdf0e10cSrcweir    Dim bUnsupportedPosition As Boolean
692*cdf0e10cSrcweir
693*cdf0e10cSrcweir    Set myIssue = New IssueInfo
694*cdf0e10cSrcweir
695*cdf0e10cSrcweir    ' Common Settings
696*cdf0e10cSrcweir    With myIssue
697*cdf0e10cSrcweir        .IssueID = CID_CHARTS_TABLES
698*cdf0e10cSrcweir        .IssueType = RID_STR_EXCEL_ISSUE_CHARTS_AND_TABLES
699*cdf0e10cSrcweir        .SubType = strSubType
700*cdf0e10cSrcweir        .Location = .CLocationSheet
701*cdf0e10cSrcweir        .SubLocation = myName
702*cdf0e10cSrcweir
703*cdf0e10cSrcweir        .IssueTypeXML = CSTR_ISSUE_CHARTS_TABLES
704*cdf0e10cSrcweir        .SubTypeXML = strXMLSubType
705*cdf0e10cSrcweir        .locationXML = .CXMLLocationSheet
706*cdf0e10cSrcweir
707*cdf0e10cSrcweir
708*cdf0e10cSrcweir        If myChart.HasTitle Then
709*cdf0e10cSrcweir            .Attributes.Add RID_STR_EXCEL_ATTRIBUTE_TITLE
710*cdf0e10cSrcweir            .Values.Add myChart.chartTitle.Text
711*cdf0e10cSrcweir        End If
712*cdf0e10cSrcweir        .Attributes.Add RID_STR_EXCEL_ATTRIBUTE_TYPE
713*cdf0e10cSrcweir        .Values.Add myChart.ChartType 'TBD - getChartTypeAsString() convert to String
714*cdf0e10cSrcweir
715*cdf0e10cSrcweir        'Pie Chart
716*cdf0e10cSrcweir        If (myChart.ChartType = xlPie) Or _
717*cdf0e10cSrcweir            (myChart.ChartType = xlPieExploded) Or _
718*cdf0e10cSrcweir            (myChart.ChartType = xlPieOfPie) Or _
719*cdf0e10cSrcweir            (myChart.ChartType = xl3DPie) Or _
720*cdf0e10cSrcweir            (myChart.ChartType = xl3DPieExploded) Then
721*cdf0e10cSrcweir            .Attributes.Add RID_STR_EXCEL_ATTRIBUTE_PIE
722*cdf0e10cSrcweir            .Values.Add RID_STR_EXCEL_ATTRIBUTE_SLICES_IN_DIFFERENT_DIRECTION
723*cdf0e10cSrcweir        End If
724*cdf0e10cSrcweir
725*cdf0e10cSrcweir        If Not myChart.PivotLayout Is Nothing Then
726*cdf0e10cSrcweir            'Pivot Chart
727*cdf0e10cSrcweir            .SubType = RID_STR_EXCEL_SUBISSUE_PIVOT & " " & strSubType
728*cdf0e10cSrcweir
729*cdf0e10cSrcweir            'Pivot Chart details
730*cdf0e10cSrcweir            .Attributes.Add RID_STR_EXCEL_ATTRIBUTE_PIVOT_TABLE_NAME
731*cdf0e10cSrcweir            .Values.Add myChart.PivotLayout.PivotTable.name
732*cdf0e10cSrcweir            .Attributes.Add RID_STR_EXCEL_ATTRIBUTE_PIVOT_FIELDS_VISIBLE
733*cdf0e10cSrcweir            .Values.Add myChart.HasPivotFields
734*cdf0e10cSrcweir            .Attributes.Add RID_STR_EXCEL_ATTRIBUTE_PIVOT_FIELDS_NUM
735*cdf0e10cSrcweir            .Values.Add myChart.PivotLayout.PivotTable.PivotFields.count
736*cdf0e10cSrcweir        End If
737*cdf0e10cSrcweir    End With
738*cdf0e10cSrcweir
739*cdf0e10cSrcweir    mAnalysis.IssuesCountArray(CID_CHARTS_TABLES) = _
740*cdf0e10cSrcweir        mAnalysis.IssuesCountArray(CID_CHARTS_TABLES) + 1
741*cdf0e10cSrcweir    mAnalysis.Issues.Add myIssue
742*cdf0e10cSrcweir
743*cdf0e10cSrcweirFinalExit:
744*cdf0e10cSrcweir    Set myIssue = Nothing
745*cdf0e10cSrcweir    Exit Sub
746*cdf0e10cSrcweir
747*cdf0e10cSrcweirHandleErrors:
748*cdf0e10cSrcweir    WriteDebug currentFunctionName & " : " & mAnalysis.name & ": " & Err.Number & " " & Err.Description & " " & Err.Source
749*cdf0e10cSrcweir    Resume FinalExit
750*cdf0e10cSrcweirEnd Sub
751*cdf0e10cSrcweir
752*cdf0e10cSrcweirFunction getLineStyleAsString(myLineStyle As XlLineStyle) As String
753*cdf0e10cSrcweir
754*cdf0e10cSrcweir    On Error GoTo HandleErrors
755*cdf0e10cSrcweir    Dim currentFunctionName As String
756*cdf0e10cSrcweir    currentFunctionName = "getLineStyleAsString"
757*cdf0e10cSrcweir
758*cdf0e10cSrcweir    Dim strVal As String
759*cdf0e10cSrcweir
760*cdf0e10cSrcweir    Select Case myLineStyle
761*cdf0e10cSrcweir    Case xlContinuous
762*cdf0e10cSrcweir        strVal = RID_STR_EXCEL_ENUMERATION_LINE_STYLE_CONTINUOUS
763*cdf0e10cSrcweir    Case xlDash
764*cdf0e10cSrcweir        strVal = RID_STR_EXCEL_ENUMERATION_LINE_STYLE_DASH
765*cdf0e10cSrcweir    Case xlDashDot
766*cdf0e10cSrcweir        strVal = RID_STR_EXCEL_ENUMERATION_LINE_STYLE_DASHDOT
767*cdf0e10cSrcweir    Case xlDot
768*cdf0e10cSrcweir        strVal = RID_STR_EXCEL_ENUMERATION_LINE_STYLE_DOT
769*cdf0e10cSrcweir    Case xlDouble
770*cdf0e10cSrcweir        strVal = RID_STR_EXCEL_ENUMERATION_LINE_STYLE_DOUBLE
771*cdf0e10cSrcweir    Case xlSlantDashDot
772*cdf0e10cSrcweir        strVal = RID_STR_EXCEL_ENUMERATION_LINE_STYLE_SLANTDASHDOT
773*cdf0e10cSrcweir    Case xlLineStyleNone
774*cdf0e10cSrcweir        strVal = RID_STR_EXCEL_ENUMERATION_LINE_STYLE_LINESTYLENONE
775*cdf0e10cSrcweir    Case Else
776*cdf0e10cSrcweir        strVal = RID_STR_EXCEL_ENUMERATION_UNKNOWN
777*cdf0e10cSrcweir    End Select
778*cdf0e10cSrcweir
779*cdf0e10cSrcweir
780*cdf0e10cSrcweir    getLineStyleAsString = strVal
781*cdf0e10cSrcweirHandleErrors:
782*cdf0e10cSrcweir    WriteDebug currentFunctionName & " : " & mAnalysis.name & ": " & Err.Number & " " & Err.Description & " " & Err.Source
783*cdf0e10cSrcweirEnd Function
784*cdf0e10cSrcweir
785*cdf0e10cSrcweirFunction getChartTypeAsString(myChartType As XlChartType) As String
786*cdf0e10cSrcweir    '*********************************************************
787*cdf0e10cSrcweir    '**** Localisation: ON HOLD ******************************
788*cdf0e10cSrcweir    '*********************************************************
789*cdf0e10cSrcweir    On Error GoTo HandleErrors
790*cdf0e10cSrcweir    Dim currentFunctionName As String
791*cdf0e10cSrcweir    currentFunctionName = "getChartTypeAsString"
792*cdf0e10cSrcweir
793*cdf0e10cSrcweir    Dim strVal As String
794*cdf0e10cSrcweir
795*cdf0e10cSrcweir    Select Case myChartType
796*cdf0e10cSrcweir    Case xl3DArea
797*cdf0e10cSrcweir        strVal = "3DArea"
798*cdf0e10cSrcweir    Case xl3DAreaStacked
799*cdf0e10cSrcweir        strVal = "3DAreaStacked"
800*cdf0e10cSrcweir    Case xl3DAreaStacked100
801*cdf0e10cSrcweir        strVal = "3DAreaStacked100"
802*cdf0e10cSrcweir    Case xl3DBarClustered
803*cdf0e10cSrcweir        strVal = "3DBarClustered"
804*cdf0e10cSrcweir    Case xl3DBarStacked
805*cdf0e10cSrcweir        strVal = "xl3DBarStacked"
806*cdf0e10cSrcweir    Case xl3DBarStacked100
807*cdf0e10cSrcweir        strVal = "xl3DBarStacked100"
808*cdf0e10cSrcweir    Case xl3DColumn
809*cdf0e10cSrcweir        strVal = "3DColumn"
810*cdf0e10cSrcweir    Case xl3DColumnClustered
811*cdf0e10cSrcweir        strVal = "xl3DColumnClustered"
812*cdf0e10cSrcweir    Case xl3DColumnStacked
813*cdf0e10cSrcweir        strVal = "xl3DColumnStacked"
814*cdf0e10cSrcweir    Case xl3DColumnStacked100
815*cdf0e10cSrcweir        strVal = "xl3DColumnStacked100"
816*cdf0e10cSrcweir    Case xl3DLine
817*cdf0e10cSrcweir        strVal = "3DLine"
818*cdf0e10cSrcweir    Case xl3DPie
819*cdf0e10cSrcweir        strVal = "3DPie"
820*cdf0e10cSrcweir    Case xl3DPieExploded
821*cdf0e10cSrcweir        strVal = "3DPieExploded"
822*cdf0e10cSrcweir    Case xlArea
823*cdf0e10cSrcweir        strVal = "Area"
824*cdf0e10cSrcweir    Case xlAreaStacked
825*cdf0e10cSrcweir        strVal = "AreaStacked"
826*cdf0e10cSrcweir    Case xlAreaStacked100
827*cdf0e10cSrcweir        strVal = "AreaStacked100"
828*cdf0e10cSrcweir    Case xlBarClustered
829*cdf0e10cSrcweir        strVal = "BarClustered"
830*cdf0e10cSrcweir    Case xlBarOfPie
831*cdf0e10cSrcweir        strVal = "BarOfPie"
832*cdf0e10cSrcweir    Case xlBarStacked
833*cdf0e10cSrcweir        strVal = "BarStacked"
834*cdf0e10cSrcweir    Case xlBarStacked100
835*cdf0e10cSrcweir        strVal = "BarStacked100"
836*cdf0e10cSrcweir    Case xlBubble
837*cdf0e10cSrcweir        strVal = "Bubble"
838*cdf0e10cSrcweir    Case xlBubble3DEffect
839*cdf0e10cSrcweir        strVal = "Bubble3DEffect"
840*cdf0e10cSrcweir    Case xlColumnClustered
841*cdf0e10cSrcweir        strVal = "ColumnClustered"
842*cdf0e10cSrcweir    Case xlColumnStacked
843*cdf0e10cSrcweir        strVal = "ColumnStacked"
844*cdf0e10cSrcweir    Case xlColumnStacked100
845*cdf0e10cSrcweir        strVal = "ColumnStacked100"
846*cdf0e10cSrcweir    Case xlConeBarClustered
847*cdf0e10cSrcweir        strVal = "ConeBarClustered"
848*cdf0e10cSrcweir    Case xlConeBarStacked
849*cdf0e10cSrcweir        strVal = "ConeBarStacked"
850*cdf0e10cSrcweir    Case xlConeBarStacked100
851*cdf0e10cSrcweir        strVal = "ConeBarStacked100"
852*cdf0e10cSrcweir    Case xlConeCol
853*cdf0e10cSrcweir        strVal = "ConeCol"
854*cdf0e10cSrcweir    Case xlConeColClustered
855*cdf0e10cSrcweir        strVal = "ConeColClustered"
856*cdf0e10cSrcweir    Case xlConeColStacked
857*cdf0e10cSrcweir        strVal = "ConeColStacked"
858*cdf0e10cSrcweir    Case xlConeColStacked100
859*cdf0e10cSrcweir        strVal = "ConeColStacked100"
860*cdf0e10cSrcweir    Case xlCylinderBarClustered
861*cdf0e10cSrcweir        strVal = "CylinderBarClustered"
862*cdf0e10cSrcweir    Case xlCylinderBarStacked
863*cdf0e10cSrcweir        strVal = "CylinderBarStacked"
864*cdf0e10cSrcweir    Case xlCylinderBarStacked100
865*cdf0e10cSrcweir        strVal = "CylinderBarStacked100"
866*cdf0e10cSrcweir    Case xlCylinderCol
867*cdf0e10cSrcweir        strVal = "CylinderCol"
868*cdf0e10cSrcweir    Case xlCylinderColClustered
869*cdf0e10cSrcweir        strVal = "CylinderColClustered"
870*cdf0e10cSrcweir    Case xlCylinderColStacked
871*cdf0e10cSrcweir        strVal = "CylinderColStacked"
872*cdf0e10cSrcweir    Case xlCylinderColStacked100
873*cdf0e10cSrcweir        strVal = "CylinderColStacked100"
874*cdf0e10cSrcweir    Case xlDoughnut
875*cdf0e10cSrcweir        strVal = "Doughnut"
876*cdf0e10cSrcweir    Case xlLine
877*cdf0e10cSrcweir        strVal = "Line"
878*cdf0e10cSrcweir    Case xlLineMarkers
879*cdf0e10cSrcweir        strVal = "LineMarkers"
880*cdf0e10cSrcweir    Case xlLineMarkersStacked
881*cdf0e10cSrcweir        strVal = "LineMarkersStacked"
882*cdf0e10cSrcweir    Case xlLineMarkersStacked100
883*cdf0e10cSrcweir        strVal = "LineMarkersStacked100"
884*cdf0e10cSrcweir    Case xlLineStacked
885*cdf0e10cSrcweir        strVal = "LineStacked"
886*cdf0e10cSrcweir    Case xlLineStacked100
887*cdf0e10cSrcweir        strVal = "LineStacked100"
888*cdf0e10cSrcweir    Case xlPie
889*cdf0e10cSrcweir        strVal = "Pie"
890*cdf0e10cSrcweir    Case xlPieExploded
891*cdf0e10cSrcweir        strVal = "PieExploded"
892*cdf0e10cSrcweir    Case xlPieOfPie
893*cdf0e10cSrcweir        strVal = "PieOfPie"
894*cdf0e10cSrcweir    Case xlPyramidBarClustered
895*cdf0e10cSrcweir        strVal = "PyramidBarClustered"
896*cdf0e10cSrcweir    Case xlPyramidBarStacked
897*cdf0e10cSrcweir        strVal = "PyramidBarStacked"
898*cdf0e10cSrcweir    Case xlPyramidBarStacked100
899*cdf0e10cSrcweir        strVal = "PyramidBarStacked100"
900*cdf0e10cSrcweir    Case xlPyramidCol
901*cdf0e10cSrcweir        strVal = "PyramidCol"
902*cdf0e10cSrcweir    Case xlPyramidColClustered
903*cdf0e10cSrcweir        strVal = "PyramidColClustered"
904*cdf0e10cSrcweir    Case xlPyramidColStacked
905*cdf0e10cSrcweir        strVal = "PyramidColStacked"
906*cdf0e10cSrcweir    Case xlPyramidColStacked100
907*cdf0e10cSrcweir        strVal = "PyramidColStacked100"
908*cdf0e10cSrcweir    Case xlRadar
909*cdf0e10cSrcweir        strVal = "Radar"
910*cdf0e10cSrcweir    Case xlRadarFilled
911*cdf0e10cSrcweir        strVal = "RadarFilled"
912*cdf0e10cSrcweir    Case xlRadarMarkers
913*cdf0e10cSrcweir        strVal = "RadarMarkers"
914*cdf0e10cSrcweir    Case xlStockHLC
915*cdf0e10cSrcweir        strVal = "StockHLC"
916*cdf0e10cSrcweir    Case xlStockOHLC
917*cdf0e10cSrcweir        strVal = "StockOHLC"
918*cdf0e10cSrcweir    Case xlStockVHLC
919*cdf0e10cSrcweir        strVal = "StockVHLC"
920*cdf0e10cSrcweir    Case xlStockVOHLC
921*cdf0e10cSrcweir        strVal = "StockVOHLC"
922*cdf0e10cSrcweir    Case xlSurface
923*cdf0e10cSrcweir        strVal = "Surface"
924*cdf0e10cSrcweir    Case xlSurfaceTopView
925*cdf0e10cSrcweir        strVal = "SurfaceTopView"
926*cdf0e10cSrcweir    Case xlSurfaceTopViewWireframe
927*cdf0e10cSrcweir        strVal = "SurfaceTopViewWireframe"
928*cdf0e10cSrcweir    Case xlSurfaceWireframe
929*cdf0e10cSrcweir        strVal = "SurfaceWireframe"
930*cdf0e10cSrcweir    Case xlXYScatter
931*cdf0e10cSrcweir        strVal = "XYScatter"
932*cdf0e10cSrcweir    Case xlXYScatterLines
933*cdf0e10cSrcweir        strVal = "XYScatterLines"
934*cdf0e10cSrcweir    Case xlXYScatterLinesNoMarkers
935*cdf0e10cSrcweir        strVal = "XYScatterLinesNoMarkers"
936*cdf0e10cSrcweir    Case xlXYScatterSmooth
937*cdf0e10cSrcweir        strVal = "XYScatterSmooth"
938*cdf0e10cSrcweir    Case xlXYScatterSmoothNoMarkers
939*cdf0e10cSrcweir        strVal = "XYScatterSmoothNoMarkers"
940*cdf0e10cSrcweir    Case Else
941*cdf0e10cSrcweir        strVal = RID_STR_EXCEL_ENUMERATION_UNKNOWN
942*cdf0e10cSrcweir    End Select
943*cdf0e10cSrcweir
944*cdf0e10cSrcweir    getChartTypeAsString = strVal
945*cdf0e10cSrcweir
946*cdf0e10cSrcweir    Exit Function
947*cdf0e10cSrcweir
948*cdf0e10cSrcweirHandleErrors:
949*cdf0e10cSrcweir    WriteDebug currentFunctionName & " : " & mAnalysis.name & ": " & Err.Number & " " & Err.Description & " " & Err.Source
950*cdf0e10cSrcweirEnd Function
951*cdf0e10cSrcweir
952*cdf0e10cSrcweirSub HandleZoomIssue(currentSheet)
953*cdf0e10cSrcweir    Dim myIssue As IssueInfo
954*cdf0e10cSrcweir    Dim currentFunctionName As String
955*cdf0e10cSrcweir    currentFunctionName = "HandleZoomIssue"
956*cdf0e10cSrcweir
957*cdf0e10cSrcweir    On Error GoTo HandleErrors
958*cdf0e10cSrcweir
959*cdf0e10cSrcweir    Set myIssue = New IssueInfo
960*cdf0e10cSrcweir    With myIssue
961*cdf0e10cSrcweir        .IssueID = CID_FORMAT
962*cdf0e10cSrcweir        .IssueType = RID_STR_EXCEL_ISSUE_FORMAT
963*cdf0e10cSrcweir        .SubType = RID_STR_EXCEL_SUBISSUE_ZOOM
964*cdf0e10cSrcweir        .Location = .CLocationSheet
965*cdf0e10cSrcweir        .SubLocation = currentSheet.name
966*cdf0e10cSrcweir
967*cdf0e10cSrcweir        .IssueTypeXML = CSTR_ISSUE_FORMAT
968*cdf0e10cSrcweir        .SubTypeXML = CSTR_SUBISSUE_ZOOM
969*cdf0e10cSrcweir        .locationXML = .CXMLLocationSheet
970*cdf0e10cSrcweir
971*cdf0e10cSrcweir        AddIssueDetailsNote myIssue, 0, RID_STR_EXCEL_NOTE_ZOOM
972*cdf0e10cSrcweir    End With
973*cdf0e10cSrcweir
974*cdf0e10cSrcweir    mAnalysis.IssuesCountArray(CID_FORMAT) = _
975*cdf0e10cSrcweir        mAnalysis.IssuesCountArray(CID_FORMAT) + 1
976*cdf0e10cSrcweir    mAnalysis.Issues.Add myIssue
977*cdf0e10cSrcweir
978*cdf0e10cSrcweirFinalExit:
979*cdf0e10cSrcweir    Set myIssue = Nothing
980*cdf0e10cSrcweir    Exit Sub
981*cdf0e10cSrcweir
982*cdf0e10cSrcweirHandleErrors:
983*cdf0e10cSrcweir    WriteDebug currentFunctionName & " : " & mAnalysis.name & ": " & Err.Number & " " & Err.Description & " " & Err.Source
984*cdf0e10cSrcweir    Resume FinalExit
985*cdf0e10cSrcweirEnd Sub
986*cdf0e10cSrcweir
987*cdf0e10cSrcweirSub Analyze_SheetDisplay(aWB As Workbook)
988*cdf0e10cSrcweir    On Error GoTo HandleErrors
989*cdf0e10cSrcweir    Dim currentFunctionName As String
990*cdf0e10cSrcweir    currentFunctionName = "Analyze_SheetDisplay"
991*cdf0e10cSrcweir
992*cdf0e10cSrcweir    If aWB.Sheets.count = 1 Then Exit Sub
993*cdf0e10cSrcweir
994*cdf0e10cSrcweir    Dim lastZoomVal As Integer
995*cdf0e10cSrcweir    Dim bInitZoom As Boolean
996*cdf0e10cSrcweir    Dim bZoomChanged As Boolean
997*cdf0e10cSrcweir    Dim ws As Object
998*cdf0e10cSrcweir
999*cdf0e10cSrcweir    bInitZoom = True
1000*cdf0e10cSrcweir    bZoomChanged = False
1001*cdf0e10cSrcweir
1002*cdf0e10cSrcweir    For Each ws In aWB.Sheets
1003*cdf0e10cSrcweir        ws.Activate
1004*cdf0e10cSrcweir
1005*cdf0e10cSrcweir        On Error GoTo HandleErrors
1006*cdf0e10cSrcweir
1007*cdf0e10cSrcweir        If bInitZoom Then
1008*cdf0e10cSrcweir            lastZoomVal = ActiveWindow.Zoom
1009*cdf0e10cSrcweir            bInitZoom = False
1010*cdf0e10cSrcweir        ElseIf Not bZoomChanged Then
1011*cdf0e10cSrcweir            If ActiveWindow.Zoom <> lastZoomVal Then
1012*cdf0e10cSrcweir                bZoomChanged = True
1013*cdf0e10cSrcweir                HandleZoomIssue ws
1014*cdf0e10cSrcweir            End If
1015*cdf0e10cSrcweir        End If
1016*cdf0e10cSrcweir        If bZoomChanged Then Exit For
1017*cdf0e10cSrcweir    Next ws
1018*cdf0e10cSrcweir
1019*cdf0e10cSrcweirFinalExit:
1020*cdf0e10cSrcweir    Exit Sub
1021*cdf0e10cSrcweir
1022*cdf0e10cSrcweirHandleErrors:
1023*cdf0e10cSrcweir    WriteDebug currentFunctionName & " : " & mAnalysis.name & ": " & Err.Number & " " & Err.Description & " " & Err.Source
1024*cdf0e10cSrcweir    Resume FinalExit
1025*cdf0e10cSrcweirEnd Sub
1026*cdf0e10cSrcweir
1027*cdf0e10cSrcweirSub Analyze_SheetLimits(aWB As Workbook)
1028*cdf0e10cSrcweir    On Error GoTo HandleErrors
1029*cdf0e10cSrcweir    Dim currentFunctionName As String
1030*cdf0e10cSrcweir    currentFunctionName = "Analyze_SheetLimits"
1031*cdf0e10cSrcweir    Dim myIssue As IssueInfo
1032*cdf0e10cSrcweir
1033*cdf0e10cSrcweir    If aWB.Sheets.count < CWORKBOOK_SHEETS_LIMIT + 1 Then Exit Sub
1034*cdf0e10cSrcweir
1035*cdf0e10cSrcweir    Set myIssue = New IssueInfo
1036*cdf0e10cSrcweir    With myIssue
1037*cdf0e10cSrcweir        .IssueID = CID_CONTENT_AND_DOCUMENT_PROPERTIES
1038*cdf0e10cSrcweir        .IssueType = RID_STR_COMMON_ISSUE_CONTENT_AND_DOCUMENT_PROPERTIES
1039*cdf0e10cSrcweir        .SubType = RID_STR_EXCEL_SUBISSUE_MAX_SHEETS_EXCEEDED
1040*cdf0e10cSrcweir        .Location = .CLocationWorkBook
1041*cdf0e10cSrcweir        .SubLocation = aWB.name
1042*cdf0e10cSrcweir
1043*cdf0e10cSrcweir        .IssueTypeXML = CSTR_ISSUE_CONTENT_DOCUMENT_PROPERTIES
1044*cdf0e10cSrcweir        .SubTypeXML = CSTR_SUBISSUE_MAX_SHEETS_EXCEEDED
1045*cdf0e10cSrcweir        .locationXML = .CXMLLocationWorkBook
1046*cdf0e10cSrcweir
1047*cdf0e10cSrcweir        .Attributes.Add RID_STR_EXCEL_ATTRIBUTE_NUMBER_OF_SHEETS
1048*cdf0e10cSrcweir        .Values.Add aWB.Sheets.count
1049*cdf0e10cSrcweir
1050*cdf0e10cSrcweir        AddIssueDetailsNote myIssue, 0, RID_STR_EXCEL_NOTE_SHEET_LIMITS_1 & CWORKBOOK_SHEETS_LIMIT
1051*cdf0e10cSrcweir        AddIssueDetailsNote myIssue, 1, RID_STR_EXCEL_NOTE_SHEET_LIMITS_2 & CWORKBOOK_SHEETS_LIMIT
1052*cdf0e10cSrcweir    End With
1053*cdf0e10cSrcweir    mAnalysis.IssuesCountArray(CID_CONTENT_AND_DOCUMENT_PROPERTIES) = _
1054*cdf0e10cSrcweir        mAnalysis.IssuesCountArray(CID_CONTENT_AND_DOCUMENT_PROPERTIES) + 1
1055*cdf0e10cSrcweir    mAnalysis.Issues.Add myIssue
1056*cdf0e10cSrcweir    Set myIssue = Nothing
1057*cdf0e10cSrcweir
1058*cdf0e10cSrcweirFinalExit:
1059*cdf0e10cSrcweir    Set myIssue = Nothing
1060*cdf0e10cSrcweir    Exit Sub
1061*cdf0e10cSrcweir
1062*cdf0e10cSrcweirHandleErrors:
1063*cdf0e10cSrcweir    WriteDebug currentFunctionName & " : " & mAnalysis.name & ": " & Err.Number & " " & Err.Description & " " & Err.Source
1064*cdf0e10cSrcweir    Resume FinalExit
1065*cdf0e10cSrcweirEnd Sub
1066*cdf0e10cSrcweir
1067*cdf0e10cSrcweirSub Analyze_SheetIssues(aWB As Workbook)
1068*cdf0e10cSrcweir    On Error GoTo HandleErrors
1069*cdf0e10cSrcweir    Dim currentFunctionName As String
1070*cdf0e10cSrcweir    currentFunctionName = "Analyze_SheetIssues"
1071*cdf0e10cSrcweir
1072*cdf0e10cSrcweir    Dim myWrkSheet As Worksheet
1073*cdf0e10cSrcweir
1074*cdf0e10cSrcweir    For Each myWrkSheet In aWB.Worksheets
1075*cdf0e10cSrcweir        Analyze_OLEEmbedded myWrkSheet
1076*cdf0e10cSrcweir        Analyze_CellInSheetIssues myWrkSheet
1077*cdf0e10cSrcweir        Analyze_EmbeddedCharts myWrkSheet
1078*cdf0e10cSrcweir        Analyze_SheetName myWrkSheet
1079*cdf0e10cSrcweir        Analyze_QueryTables myWrkSheet
1080*cdf0e10cSrcweir    Next myWrkSheet
1081*cdf0e10cSrcweir
1082*cdf0e10cSrcweir    Exit Sub
1083*cdf0e10cSrcweirHandleErrors:
1084*cdf0e10cSrcweir    WriteDebug currentFunctionName & " : " & mAnalysis.name & ": " & Err.Number & " " & Err.Description & " " & Err.Source
1085*cdf0e10cSrcweirEnd Sub
1086*cdf0e10cSrcweir
1087*cdf0e10cSrcweirSub Analyze_SheetName(mySheet As Worksheet)
1088*cdf0e10cSrcweir    On Error GoTo HandleErrors
1089*cdf0e10cSrcweir    Dim currentFunctionName As String
1090*cdf0e10cSrcweir    currentFunctionName = "Analyze_SheetName"
1091*cdf0e10cSrcweir    Dim myIssue As IssueInfo
1092*cdf0e10cSrcweir    Set myIssue = New IssueInfo
1093*cdf0e10cSrcweir
1094*cdf0e10cSrcweir    Dim invalidCharacters As String
1095*cdf0e10cSrcweir    invalidCharacters = InvalidSheetNameCharacters(mySheet.name)
1096*cdf0e10cSrcweir    If Len(invalidCharacters) <> 0 Then
1097*cdf0e10cSrcweir        With myIssue
1098*cdf0e10cSrcweir            .IssueID = CID_CONTENT_AND_DOCUMENT_PROPERTIES
1099*cdf0e10cSrcweir            .IssueType = RID_STR_COMMON_ISSUE_CONTENT_AND_DOCUMENT_PROPERTIES
1100*cdf0e10cSrcweir            .SubType = RID_STR_EXCEL_SUBISSUE_INVALID_WORKSHEET_NAME
1101*cdf0e10cSrcweir            .Location = .CLocationSheet
1102*cdf0e10cSrcweir            .SubLocation = mySheet.name
1103*cdf0e10cSrcweir
1104*cdf0e10cSrcweir            .IssueTypeXML = CSTR_ISSUE_CONTENT_DOCUMENT_PROPERTIES
1105*cdf0e10cSrcweir            .SubTypeXML = CSTR_SUBISSUE_INVALID_WORKSHEET_NAME
1106*cdf0e10cSrcweir            .locationXML = .CXMLLocationSheet
1107*cdf0e10cSrcweir
1108*cdf0e10cSrcweir            .Attributes.Add RID_STR_EXCEL_ATTRIBUTE_INVALIDCHARACTER
1109*cdf0e10cSrcweir            .Values.Add invalidCharacters
1110*cdf0e10cSrcweir
1111*cdf0e10cSrcweir            AddIssueDetailsNote myIssue, 0, RID_STR_EXCEL_NOTE_INVALIDWORKSHEETNAME
1112*cdf0e10cSrcweir
1113*cdf0e10cSrcweir            mAnalysis.IssuesCountArray(CID_CONTENT_AND_DOCUMENT_PROPERTIES) = _
1114*cdf0e10cSrcweir                    mAnalysis.IssuesCountArray(CID_CONTENT_AND_DOCUMENT_PROPERTIES) + 1
1115*cdf0e10cSrcweir        End With
1116*cdf0e10cSrcweir        mAnalysis.Issues.Add myIssue
1117*cdf0e10cSrcweir    End If
1118*cdf0e10cSrcweir
1119*cdf0e10cSrcweirFinalExit:
1120*cdf0e10cSrcweir    Set myIssue = Nothing
1121*cdf0e10cSrcweir    Exit Sub
1122*cdf0e10cSrcweir
1123*cdf0e10cSrcweirHandleErrors:
1124*cdf0e10cSrcweir    WriteDebug currentFunctionName & " : " & mAnalysis.name & ": " & Err.Number & " " & Err.Description & " " & Err.Source
1125*cdf0e10cSrcweir    Resume FinalExit
1126*cdf0e10cSrcweirEnd Sub
1127*cdf0e10cSrcweir
1128*cdf0e10cSrcweirFunction InvalidSheetNameCharacters(aName As String) As String
1129*cdf0e10cSrcweir    On Error GoTo HandleErrors
1130*cdf0e10cSrcweir    Dim currentFunctionName As String
1131*cdf0e10cSrcweir    currentFunctionName = "InvalidSheetNameCharacters"
1132*cdf0e10cSrcweir
1133*cdf0e10cSrcweir    Dim I As Integer
1134*cdf0e10cSrcweir    Dim NameCount As Integer
1135*cdf0e10cSrcweir    Dim newBadCharLine As String
1136*cdf0e10cSrcweir    Dim invalidCharacterDetails As String
1137*cdf0e10cSrcweir    Dim BadCharPosition As String
1138*cdf0e10cSrcweir    Dim theBadChars As BadSheetNameChar
1139*cdf0e10cSrcweir    NameCount = Len(aName)
1140*cdf0e10cSrcweir    invalidCharacterDetails = ""
1141*cdf0e10cSrcweir    For I = 1 To NameCount
1142*cdf0e10cSrcweir        theBadChars.BadChar = Mid(aName, I, 1)
1143*cdf0e10cSrcweir        theBadChars.Position = I
1144*cdf0e10cSrcweir        BadCharPosition = CStr(theBadChars.Position)
1145*cdf0e10cSrcweir        Select Case theBadChars.BadChar
1146*cdf0e10cSrcweir        Case "[", "]", "{", "}", ".", "!", "%", "$", "^", ".", "&", "(", ")", _
1147*cdf0e10cSrcweir            "-", "=", "+", "~", "#", "@", "'", ";", "<", ">", ",", "|", "`"
1148*cdf0e10cSrcweir            newBadCharLine = ReplaceTopic2Tokens(RID_STR_EXCEL_ATTRIBUTE_BADCHARACTER, CR_BADCHAR, _
1149*cdf0e10cSrcweir                theBadChars.BadChar, CR_BADCHARNUM, BadCharPosition)
1150*cdf0e10cSrcweir            invalidCharacterDetails = invalidCharacterDetails + newBadCharLine + ", "
1151*cdf0e10cSrcweir        Case Else
1152*cdf0e10cSrcweir        End Select
1153*cdf0e10cSrcweir    Next I
1154*cdf0e10cSrcweir    If Len(invalidCharacterDetails) > 0 Then
1155*cdf0e10cSrcweir        InvalidSheetNameCharacters = Left(invalidCharacterDetails, (Len(invalidCharacterDetails) - 2))
1156*cdf0e10cSrcweir    Else
1157*cdf0e10cSrcweir        InvalidSheetNameCharacters = ""
1158*cdf0e10cSrcweir    End If
1159*cdf0e10cSrcweir    Exit Function
1160*cdf0e10cSrcweir
1161*cdf0e10cSrcweirHandleErrors:
1162*cdf0e10cSrcweir    WriteDebug currentFunctionName & " : " & mAnalysis.name & ": " & Err.Number & " " & Err.Description & " " & Err.Source
1163*cdf0e10cSrcweir
1164*cdf0e10cSrcweirEnd Function
1165*cdf0e10cSrcweir
1166*cdf0e10cSrcweirSub Analyze_QueryTables(mySheet As Worksheet)
1167*cdf0e10cSrcweir    On Error GoTo HandleErrors
1168*cdf0e10cSrcweir    Dim currentFunctionName As String
1169*cdf0e10cSrcweir    currentFunctionName = "Analyze_QueryTables"
1170*cdf0e10cSrcweir
1171*cdf0e10cSrcweir    Dim aTable As QueryTable
1172*cdf0e10cSrcweir    Dim myIssue As IssueInfo
1173*cdf0e10cSrcweir    Set myIssue = New IssueInfo
1174*cdf0e10cSrcweir
1175*cdf0e10cSrcweir    For Each aTable In mySheet.QueryTables
1176*cdf0e10cSrcweir        If (aTable.QueryType = xlADORecordset) Or _
1177*cdf0e10cSrcweir           (aTable.QueryType = xlDAORecordSet) Or _
1178*cdf0e10cSrcweir           (aTable.QueryType = xlODBCQuery) Or _
1179*cdf0e10cSrcweir           (aTable.QueryType = xlOLEDBQuery) Then
1180*cdf0e10cSrcweir
1181*cdf0e10cSrcweir            With myIssue
1182*cdf0e10cSrcweir                .IssueID = CID_CHARTS_TABLES
1183*cdf0e10cSrcweir                .IssueType = RID_STR_EXCEL_ISSUE_CHARTS_AND_TABLES
1184*cdf0e10cSrcweir                .SubType = RID_RESXLS_COST_DB_Query
1185*cdf0e10cSrcweir                .Location = .CLocationSheet
1186*cdf0e10cSrcweir                .SubLocation = mySheet.name
1187*cdf0e10cSrcweir
1188*cdf0e10cSrcweir                .IssueTypeXML = CSTR_ISSUE_CHARTS_TABLES
1189*cdf0e10cSrcweir                .SubTypeXML = CSTR_SUBISSUE_DB_QUERY
1190*cdf0e10cSrcweir                .locationXML = .CXMLLocationSheet
1191*cdf0e10cSrcweir
1192*cdf0e10cSrcweir                .Attributes.Add RID_STR_EXCEL_ATTRIBUTE_DB_QUERY
1193*cdf0e10cSrcweir                .Values.Add aTable.Connection
1194*cdf0e10cSrcweir
1195*cdf0e10cSrcweir                AddIssueDetailsNote myIssue, 0, RID_STR_EXCEL_NOTE_DB_QUERY
1196*cdf0e10cSrcweir
1197*cdf0e10cSrcweir                mAnalysis.IssuesCountArray(CID_CHARTS_TABLES) = _
1198*cdf0e10cSrcweir                        mAnalysis.IssuesCountArray(CID_CHARTS_TABLES) + 1
1199*cdf0e10cSrcweir            End With
1200*cdf0e10cSrcweir            mAnalysis.Issues.Add myIssue
1201*cdf0e10cSrcweir        End If
1202*cdf0e10cSrcweir    Next aTable
1203*cdf0e10cSrcweir
1204*cdf0e10cSrcweirFinalExit:
1205*cdf0e10cSrcweir    Set myIssue = Nothing
1206*cdf0e10cSrcweir    Exit Sub
1207*cdf0e10cSrcweir
1208*cdf0e10cSrcweirHandleErrors:
1209*cdf0e10cSrcweir    WriteDebug currentFunctionName & " : " & mAnalysis.name & ": " & Err.Number & " " & Err.Description & " " & Err.Source
1210*cdf0e10cSrcweir    Resume FinalExit
1211*cdf0e10cSrcweirEnd Sub
1212*cdf0e10cSrcweir
1213*cdf0e10cSrcweirSub Analyze_WorkbookVersion(aWB As Workbook)
1214*cdf0e10cSrcweir    On Error GoTo HandleErrors
1215*cdf0e10cSrcweir    Dim currentFunctionName As String
1216*cdf0e10cSrcweir    currentFunctionName = "Analyze_WorkbookVersion"
1217*cdf0e10cSrcweir    Dim myIssue As IssueInfo
1218*cdf0e10cSrcweir    Set myIssue = New IssueInfo
1219*cdf0e10cSrcweir    Dim aProp As Variant
1220*cdf0e10cSrcweir
1221*cdf0e10cSrcweir    If IsOldVersion(aWB.FileFormat) Then
1222*cdf0e10cSrcweir        With myIssue
1223*cdf0e10cSrcweir            .IssueID = CID_CONTENT_AND_DOCUMENT_PROPERTIES
1224*cdf0e10cSrcweir            .IssueType = RID_STR_COMMON_ISSUE_CONTENT_AND_DOCUMENT_PROPERTIES
1225*cdf0e10cSrcweir            .SubType = RID_STR_EXCEL_SUBISSUE_OLD_WORKBOOK_VERSION
1226*cdf0e10cSrcweir            .Location = .CLocationWorkBook
1227*cdf0e10cSrcweir
1228*cdf0e10cSrcweir            .IssueTypeXML = CSTR_ISSUE_CONTENT_DOCUMENT_PROPERTIES
1229*cdf0e10cSrcweir            .SubTypeXML = CSTR_SUBISSUE_OLD_WORKBOOK_VERSION
1230*cdf0e10cSrcweir            .locationXML = .CXMLLocationWorkBook
1231*cdf0e10cSrcweir
1232*cdf0e10cSrcweir            .Attributes.Add RID_STR_EXCEL_ATTRIBUTE_WORKBOOK_VERSION
1233*cdf0e10cSrcweir            .Values.Add aWB.FileFormat
1234*cdf0e10cSrcweir
1235*cdf0e10cSrcweir            AddIssueDetailsNote myIssue, 0, RID_STR_EXCEL_NOTE_OLDWORKBOOKVERSION
1236*cdf0e10cSrcweir
1237*cdf0e10cSrcweir            mAnalysis.IssuesCountArray(CID_CONTENT_AND_DOCUMENT_PROPERTIES) = _
1238*cdf0e10cSrcweir                    mAnalysis.IssuesCountArray(CID_CONTENT_AND_DOCUMENT_PROPERTIES) + 1
1239*cdf0e10cSrcweir        End With
1240*cdf0e10cSrcweir        Call DoPreparation(mAnalysis, myIssue, RID_STR_EXCEL_NOTE_OLD_OLDWORKBOOKVERSION_PREPARABLE, aProp, aWB)
1241*cdf0e10cSrcweir
1242*cdf0e10cSrcweir        mAnalysis.Issues.Add myIssue
1243*cdf0e10cSrcweir    End If
1244*cdf0e10cSrcweir
1245*cdf0e10cSrcweirFinalExit:
1246*cdf0e10cSrcweir    Set myIssue = Nothing
1247*cdf0e10cSrcweir    Exit Sub
1248*cdf0e10cSrcweir
1249*cdf0e10cSrcweirHandleErrors:
1250*cdf0e10cSrcweir    WriteDebug currentFunctionName & " : " & mAnalysis.name & ": " & Err.Number & " " & Err.Description & " " & Err.Source
1251*cdf0e10cSrcweir    Resume FinalExit
1252*cdf0e10cSrcweirEnd Sub
1253*cdf0e10cSrcweir
1254*cdf0e10cSrcweirFunction getRange(myRange As Range) As String
1255*cdf0e10cSrcweir    On Error GoTo HandleErrors
1256*cdf0e10cSrcweir    Dim currentFunctionName As String
1257*cdf0e10cSrcweir    currentFunctionName = "getRange"
1258*cdf0e10cSrcweir    getRange = ""
1259*cdf0e10cSrcweir
1260*cdf0e10cSrcweir    On Error Resume Next
1261*cdf0e10cSrcweir    getRange = myRange.Address(RowAbsolute:=False, ColumnAbsolute:=False, ReferenceStyle:=xlA1)
1262*cdf0e10cSrcweir
1263*cdf0e10cSrcweirFinalExit:
1264*cdf0e10cSrcweir    Exit Function
1265*cdf0e10cSrcweir
1266*cdf0e10cSrcweirHandleErrors:
1267*cdf0e10cSrcweir    WriteDebug currentFunctionName & " : myRange.name " & myRange.name & ": " & Err.Number & " " & Err.Description & " " & Err.Source
1268*cdf0e10cSrcweir    Resume FinalExit
1269*cdf0e10cSrcweirEnd Function
1270*cdf0e10cSrcweir
1271*cdf0e10cSrcweirSub Analyze_CellInSheetIssues(mySheet As Worksheet)
1272*cdf0e10cSrcweir    On Error GoTo HandleErrors
1273*cdf0e10cSrcweir    Dim currentFunctionName As String
1274*cdf0e10cSrcweir    currentFunctionName = "Analyze_CellInSheetIssues"
1275*cdf0e10cSrcweir    Dim myCellRng As Range
1276*cdf0e10cSrcweir
1277*cdf0e10cSrcweir    Set myCellRng = mySheet.UsedRange
1278*cdf0e10cSrcweir    Call CheckAllCellFormatting(myCellRng, mySheet.name)
1279*cdf0e10cSrcweir    Call CheckAllCellFunctions(myCellRng, mySheet.name)
1280*cdf0e10cSrcweir
1281*cdf0e10cSrcweirFinalExit:
1282*cdf0e10cSrcweir    Exit Sub
1283*cdf0e10cSrcweirHandleErrors:
1284*cdf0e10cSrcweir    WriteDebug currentFunctionName & " : " & mAnalysis.name & ": " & Err.Number & " " & Err.Description & " " & Err.Source
1285*cdf0e10cSrcweirEnd Sub
1286*cdf0e10cSrcweir
1287*cdf0e10cSrcweirSub CheckAllCellFormatting(CurrRange As Range, myName As String)
1288*cdf0e10cSrcweir    On Error GoTo HandleErrors
1289*cdf0e10cSrcweir    Dim currentFunctionName As String
1290*cdf0e10cSrcweir    currentFunctionName = "CheckAllCellFormatting"
1291*cdf0e10cSrcweir
1292*cdf0e10cSrcweir    Dim myCell As Range
1293*cdf0e10cSrcweir    Dim myCellAttri As CellAtrributes
1294*cdf0e10cSrcweir    Dim bCellIssue As Boolean
1295*cdf0e10cSrcweir    Dim bCellIssueAll As Boolean
1296*cdf0e10cSrcweir    Dim startTime As Single
1297*cdf0e10cSrcweir
1298*cdf0e10cSrcweir    bCellIssue = False
1299*cdf0e10cSrcweir    bCellIssueAll = False
1300*cdf0e10cSrcweir    startTime = Timer
1301*cdf0e10cSrcweir
1302*cdf0e10cSrcweir    For Each myCell In CurrRange
1303*cdf0e10cSrcweir        bCellIssue = CheckCellFormatting(myCell, myCellAttri)
1304*cdf0e10cSrcweir        bCellIssueAll = bCellIssueAll Or bCellIssue
1305*cdf0e10cSrcweir        If (Timer - gExcelMaxRangeProcessTime > startTime) Then
1306*cdf0e10cSrcweir            WriteDebug currentFunctionName & " : [" & myName & _
1307*cdf0e10cSrcweir                           "]Too much time needed, abortet cell formatting check."
1308*cdf0e10cSrcweir            Exit For
1309*cdf0e10cSrcweir        End If
1310*cdf0e10cSrcweir    Next
1311*cdf0e10cSrcweir
1312*cdf0e10cSrcweirFinalExit:
1313*cdf0e10cSrcweir    If bCellIssueAll Then
1314*cdf0e10cSrcweir        ReportCellFormattingIssue myName, myCellAttri
1315*cdf0e10cSrcweir    End If
1316*cdf0e10cSrcweir
1317*cdf0e10cSrcweir    Exit Sub
1318*cdf0e10cSrcweir
1319*cdf0e10cSrcweirHandleErrors:
1320*cdf0e10cSrcweir    WriteDebug currentFunctionName & " : " & mAnalysis.name & ": " & Err.Number & " " & Err.Description & " " & Err.Source
1321*cdf0e10cSrcweirEnd Sub
1322*cdf0e10cSrcweir
1323*cdf0e10cSrcweirFunction CheckLineFormatIssue(myRange As Range, edge As XlBordersIndex) As Boolean
1324*cdf0e10cSrcweir    CheckLineFormatIssue = (myRange.Borders(edge).LineStyle <> xlContinuous) And _
1325*cdf0e10cSrcweir        (myRange.Borders(edge).LineStyle <> xlDouble) And _
1326*cdf0e10cSrcweir        (myRange.Borders(edge).LineStyle <> xlLineStyleNone)
1327*cdf0e10cSrcweirEnd Function
1328*cdf0e10cSrcweir
1329*cdf0e10cSrcweirPrivate Function CheckCellFormatting(myCell As Range, myCellAttri As CellAtrributes) As Boolean
1330*cdf0e10cSrcweir    Dim currentFunctionName As String
1331*cdf0e10cSrcweir    currentFunctionName = "CheckCellFormatting"
1332*cdf0e10cSrcweir
1333*cdf0e10cSrcweir    On Error GoTo HandleErrors
1334*cdf0e10cSrcweir
1335*cdf0e10cSrcweir    Dim bCellLineFormatIssue As Boolean
1336*cdf0e10cSrcweir
1337*cdf0e10cSrcweir    CheckCellFormatting = False
1338*cdf0e10cSrcweir
1339*cdf0e10cSrcweir    bCellLineFormatIssue = CheckLineFormatIssue(myCell, xlEdgeBottom) Or _
1340*cdf0e10cSrcweir        CheckLineFormatIssue(myCell, xlEdgeLeft) Or _
1341*cdf0e10cSrcweir        CheckLineFormatIssue(myCell, xlEdgeRight) Or _
1342*cdf0e10cSrcweir        CheckLineFormatIssue(myCell, xlEdgeTop)
1343*cdf0e10cSrcweir
1344*cdf0e10cSrcweir    CheckCellFormatting = bCellLineFormatIssue Or _
1345*cdf0e10cSrcweir        (myCell.Interior.Pattern <> xlPatternSolid And myCell.Interior.Pattern <> xlPatternNone)
1346*cdf0e10cSrcweir
1347*cdf0e10cSrcweir    If Not CheckCellFormatting Then Exit Function
1348*cdf0e10cSrcweir
1349*cdf0e10cSrcweir            If bCellLineFormatIssue Then
1350*cdf0e10cSrcweir                myCellAttri.LineStyle = myCellAttri.LineStyle + 1
1351*cdf0e10cSrcweir            End If
1352*cdf0e10cSrcweir            If (myCell.Interior.Pattern <> xlPatternSolid And myCell.Interior.Pattern <> xlPatternNone) Then
1353*cdf0e10cSrcweir                myCellAttri.FillPattern = myCellAttri.FillPattern + 1
1354*cdf0e10cSrcweir            End If
1355*cdf0e10cSrcweir
1356*cdf0e10cSrcweir    Exit Function
1357*cdf0e10cSrcweirHandleErrors:
1358*cdf0e10cSrcweir    WriteDebug currentFunctionName & " : " & mAnalysis.name & ": " & Err.Number & " " & Err.Description & " " & Err.Source
1359*cdf0e10cSrcweirEnd Function
1360*cdf0e10cSrcweir
1361*cdf0e10cSrcweirPrivate Sub ReportCellFormattingIssue(myName As String, myCellAttri As CellAtrributes)
1362*cdf0e10cSrcweir    Dim currentFunctionName As String
1363*cdf0e10cSrcweir    currentFunctionName = "ReportCellFormattingIssue"
1364*cdf0e10cSrcweir
1365*cdf0e10cSrcweir    On Error GoTo HandleErrors
1366*cdf0e10cSrcweir
1367*cdf0e10cSrcweir    Dim myIssue As IssueInfo
1368*cdf0e10cSrcweir    Set myIssue = New IssueInfo
1369*cdf0e10cSrcweir
1370*cdf0e10cSrcweir        With myIssue
1371*cdf0e10cSrcweir            .IssueID = CID_FORMAT
1372*cdf0e10cSrcweir            .IssueType = RID_STR_EXCEL_ISSUE_FORMAT
1373*cdf0e10cSrcweir            .SubType = RID_STR_EXCEL_SUBISSUE_ATTRIBUTES
1374*cdf0e10cSrcweir            .Location = .CLocationSheet
1375*cdf0e10cSrcweir
1376*cdf0e10cSrcweir            .IssueTypeXML = CSTR_ISSUE_FORMAT
1377*cdf0e10cSrcweir            .SubTypeXML = CSTR_SUBISSUE_ATTRIBUTES
1378*cdf0e10cSrcweir            .locationXML = .CXMLLocationSheet
1379*cdf0e10cSrcweir
1380*cdf0e10cSrcweir            .SubLocation = myName
1381*cdf0e10cSrcweir            '.Line = myCell.row
1382*cdf0e10cSrcweir            '.column = Chr(myCell.column + 65 - 1)
1383*cdf0e10cSrcweir
1384*cdf0e10cSrcweir            Dim noteCount As Long
1385*cdf0e10cSrcweir            noteCount = 0
1386*cdf0e10cSrcweir
1387*cdf0e10cSrcweir            If myCellAttri.LineStyle > 0 Then
1388*cdf0e10cSrcweir                .Attributes.Add RID_STR_EXCEL_ATTRIBUTE_LINE_STYLE
1389*cdf0e10cSrcweir                .Values.Add RID_STR_EXCEL_ATTRIBUTE_DASHED_DOT
1390*cdf0e10cSrcweir                .Attributes.Add RID_STR_EXCEL_ATTRIBUTE_NUMBER_OF_CELLS
1391*cdf0e10cSrcweir                .Values.Add myCellAttri.LineStyle
1392*cdf0e10cSrcweir                AddIssueDetailsNote myIssue, noteCount, RID_STR_EXCEL_NOTE_CELL_ATTRIBUTES_3
1393*cdf0e10cSrcweir                noteCount = noteCount + 1
1394*cdf0e10cSrcweir            End If
1395*cdf0e10cSrcweir            If myCellAttri.FillPattern > 0 Then
1396*cdf0e10cSrcweir                .Attributes.Add RID_STR_EXCEL_ATTRIBUTE_FILL_PATTERN
1397*cdf0e10cSrcweir                .Values.Add RID_STR_EXCEL_ATTRIBUTE_PATTERNED
1398*cdf0e10cSrcweir                .Attributes.Add RID_STR_EXCEL_ATTRIBUTE_NUMBER_OF_CELLS
1399*cdf0e10cSrcweir                .Values.Add myCellAttri.FillPattern
1400*cdf0e10cSrcweir                AddIssueDetailsNote myIssue, noteCount, RID_STR_EXCEL_NOTE_CELL_ATTRIBUTES_4
1401*cdf0e10cSrcweir                noteCount = noteCount + 1
1402*cdf0e10cSrcweir            End If
1403*cdf0e10cSrcweir
1404*cdf0e10cSrcweir
1405*cdf0e10cSrcweir            mAnalysis.IssuesCountArray(CID_FORMAT) = _
1406*cdf0e10cSrcweir                    mAnalysis.IssuesCountArray(CID_FORMAT) + 1
1407*cdf0e10cSrcweir        End With
1408*cdf0e10cSrcweir
1409*cdf0e10cSrcweir        mAnalysis.Issues.Add myIssue
1410*cdf0e10cSrcweir
1411*cdf0e10cSrcweirFinalExit:
1412*cdf0e10cSrcweir    Set myIssue = Nothing
1413*cdf0e10cSrcweir    Exit Sub
1414*cdf0e10cSrcweirHandleErrors:
1415*cdf0e10cSrcweir    WriteDebug currentFunctionName & " : " & mAnalysis.name & ": " & Err.Number & " " & Err.Description & " " & Err.Source
1416*cdf0e10cSrcweirEnd Sub
1417*cdf0e10cSrcweir
1418*cdf0e10cSrcweirSub CheckAllCellFunctions(CurrRange As Range, myName As String)
1419*cdf0e10cSrcweir    On Error GoTo HandleErrors
1420*cdf0e10cSrcweir    Dim currentFunctionName As String
1421*cdf0e10cSrcweir    currentFunctionName = "CheckAllCellFunctions"
1422*cdf0e10cSrcweir
1423*cdf0e10cSrcweir    Dim myCell As Range
1424*cdf0e10cSrcweir    Dim startTime As Single
1425*cdf0e10cSrcweir
1426*cdf0e10cSrcweir    startTime = Timer
1427*cdf0e10cSrcweir
1428*cdf0e10cSrcweir    For Each myCell In CurrRange
1429*cdf0e10cSrcweir        Call CheckCellFunction(myCell, myName)
1430*cdf0e10cSrcweir        If (Timer - gExcelMaxRangeProcessTime > startTime) Then
1431*cdf0e10cSrcweir            WriteDebug currentFunctionName & " : [" & myName & _
1432*cdf0e10cSrcweir                       "]Too much time needed, abortet cell functions check (xlCellTypeFormulas)."
1433*cdf0e10cSrcweir            Exit For
1434*cdf0e10cSrcweir        End If
1435*cdf0e10cSrcweir    Next
1436*cdf0e10cSrcweir
1437*cdf0e10cSrcweirFinalExit:
1438*cdf0e10cSrcweir    Exit Sub
1439*cdf0e10cSrcweirHandleErrors:
1440*cdf0e10cSrcweir    WriteDebug currentFunctionName & " : " & mAnalysis.name & ": " & Err.Number & " " & Err.Description & " " & Err.Source
1441*cdf0e10cSrcweirEnd Sub
1442*cdf0e10cSrcweir
1443*cdf0e10cSrcweirSub CheckCellFunction(myCell As Range, myName As String)
1444*cdf0e10cSrcweir    Dim currentFunctionName As String
1445*cdf0e10cSrcweir    currentFunctionName = "CheckCellFunction"
1446*cdf0e10cSrcweir
1447*cdf0e10cSrcweir    On Error GoTo HandleErrors
1448*cdf0e10cSrcweir    Dim bCellFunctionIssue As Boolean
1449*cdf0e10cSrcweir    Dim bCellINFOFunctionIssue As Boolean
1450*cdf0e10cSrcweir    Dim bCellERROR_TYPEFunctionIssue As Boolean
1451*cdf0e10cSrcweir    Dim bCellExternalFunctionIssue As Boolean
1452*cdf0e10cSrcweir    Dim bHasDateDifFunction As Boolean
1453*cdf0e10cSrcweir    Dim bHasPhoneticFunction As Boolean
1454*cdf0e10cSrcweir    Dim aFormularStr As String
1455*cdf0e10cSrcweir
1456*cdf0e10cSrcweir    aFormularStr = myCell.FormulaR1C1
1457*cdf0e10cSrcweir
1458*cdf0e10cSrcweir    If (aFormularStr = Null) Then Exit Sub
1459*cdf0e10cSrcweir    If (aFormularStr = "") Then Exit Sub
1460*cdf0e10cSrcweir
1461*cdf0e10cSrcweir    bCellINFOFunctionIssue = (InStr(aFormularStr, "INFO(") <> 0)
1462*cdf0e10cSrcweir    bCellERROR_TYPEFunctionIssue = (InStr(aFormularStr, "ERROR.TYPE(") <> 0)
1463*cdf0e10cSrcweir    bCellExternalFunctionIssue = (InStr(aFormularStr, ".xls!") <> 0)
1464*cdf0e10cSrcweir    bHasDateDifFunction = (InStr(aFormularStr, "DATEDIF(") <> 0)
1465*cdf0e10cSrcweir    bHasPhoneticFunction = (InStr(aFormularStr, "PHONETIC(") <> 0)
1466*cdf0e10cSrcweir
1467*cdf0e10cSrcweir    bCellFunctionIssue = bCellINFOFunctionIssue Or bCellERROR_TYPEFunctionIssue _
1468*cdf0e10cSrcweir                         Or bCellExternalFunctionIssue Or bHasDateDifFunction Or bHasPhoneticFunction
1469*cdf0e10cSrcweir
1470*cdf0e10cSrcweir    If Not bCellFunctionIssue Then Exit Sub
1471*cdf0e10cSrcweir
1472*cdf0e10cSrcweir    Dim myIssue As IssueInfo
1473*cdf0e10cSrcweir    Set myIssue = New IssueInfo
1474*cdf0e10cSrcweir
1475*cdf0e10cSrcweir    With myIssue
1476*cdf0e10cSrcweir        .IssueID = CID_FUNCTIONS
1477*cdf0e10cSrcweir        .IssueType = RID_STR_EXCEL_ISSUE_FUNCTIONS
1478*cdf0e10cSrcweir        .Location = .CLocationSheet
1479*cdf0e10cSrcweir
1480*cdf0e10cSrcweir        .IssueTypeXML = CSTR_ISSUE_FUNCTIONS
1481*cdf0e10cSrcweir        .locationXML = .CXMLLocationSheet
1482*cdf0e10cSrcweir
1483*cdf0e10cSrcweir        .SubLocation = myName
1484*cdf0e10cSrcweir        .Line = myCell.row
1485*cdf0e10cSrcweir        .column = Chr(myCell.column + 65 - 1)
1486*cdf0e10cSrcweir
1487*cdf0e10cSrcweir        Dim noteCount As Long
1488*cdf0e10cSrcweir        noteCount = 0
1489*cdf0e10cSrcweir        If bCellINFOFunctionIssue Then
1490*cdf0e10cSrcweir            .SubTypeXML = CSTR_SUBISSUE_INFO
1491*cdf0e10cSrcweir            .SubType = RID_STR_EXCEL_SUBISSUE_INFO
1492*cdf0e10cSrcweir            .Attributes.Add RID_STR_EXCEL_ATTRIBUTE_FUNCTION_STRING
1493*cdf0e10cSrcweir            .Values.Add myCell.FormulaR1C1
1494*cdf0e10cSrcweir            AddIssueDetailsNote myIssue, noteCount, RID_STR_EXCEL_NOTE_CELL_FUNCTIONS_1
1495*cdf0e10cSrcweir            noteCount = noteCount + 1
1496*cdf0e10cSrcweir        End If
1497*cdf0e10cSrcweir        If bCellERROR_TYPEFunctionIssue Then
1498*cdf0e10cSrcweir            .SubTypeXML = CSTR_SUBISSUE_ERROR_TYPE
1499*cdf0e10cSrcweir            .SubType = RID_STR_EXCEL_SUBISSUE_ERROR_TYPE
1500*cdf0e10cSrcweir            .Attributes.Add RID_STR_EXCEL_ATTRIBUTE_FUNCTION_STRING
1501*cdf0e10cSrcweir            .Values.Add myCell.FormulaR1C1
1502*cdf0e10cSrcweir            AddIssueDetailsNote myIssue, noteCount, RID_STR_EXCEL_NOTE_CELL_FUNCTIONS_2
1503*cdf0e10cSrcweir            noteCount = noteCount + 1
1504*cdf0e10cSrcweir        End If
1505*cdf0e10cSrcweir        If bCellExternalFunctionIssue Then
1506*cdf0e10cSrcweir            .SubTypeXML = CSTR_SUBISSUE_EXTERNAL
1507*cdf0e10cSrcweir            .SubType = RID_STR_EXCEL_SUBISSUE_EXTERNAL
1508*cdf0e10cSrcweir            .Attributes.Add RID_STR_EXCEL_ATTRIBUTE_FUNCTION_STRING
1509*cdf0e10cSrcweir            .Values.Add myCell.FormulaR1C1
1510*cdf0e10cSrcweir            AddIssueDetailsNote myIssue, noteCount, RID_STR_EXCEL_NOTE_CELL_FUNCTIONS_3
1511*cdf0e10cSrcweir            noteCount = noteCount + 1
1512*cdf0e10cSrcweir        End If
1513*cdf0e10cSrcweir        If bHasDateDifFunction Then
1514*cdf0e10cSrcweir            .SubTypeXML = CSTR_SUBISSUE_DATEDIF
1515*cdf0e10cSrcweir            .SubType = RID_STR_EXCEL_SUBISSUE_DATEDIF
1516*cdf0e10cSrcweir            .Attributes.Add RID_STR_EXCEL_ATTRIBUTE_FUNCTION_STRING
1517*cdf0e10cSrcweir            .Values.Add myCell.FormulaR1C1
1518*cdf0e10cSrcweir            AddIssueDetailsNote myIssue, noteCount, RID_STR_EXCEL_NOTE_CELL_FUNCTIONS_DATEDIF
1519*cdf0e10cSrcweir            noteCount = noteCount + 1
1520*cdf0e10cSrcweir        End If
1521*cdf0e10cSrcweir        If bHasPhoneticFunction Then
1522*cdf0e10cSrcweir            .SubTypeXML = CSTR_SUBISSUE_PHONETIC
1523*cdf0e10cSrcweir            .SubType = RID_STR_EXCEL_SUBISSUE_PHONETIC
1524*cdf0e10cSrcweir            .Attributes.Add RID_STR_EXCEL_ATTRIBUTE_FUNCTION_STRING
1525*cdf0e10cSrcweir            .Values.Add myCell.FormulaR1C1
1526*cdf0e10cSrcweir            AddIssueDetailsNote myIssue, noteCount, RID_STR_EXCEL_NOTE_CELL_FUNCTIONS_PHONETIC
1527*cdf0e10cSrcweir            noteCount = noteCount + 1
1528*cdf0e10cSrcweir        End If
1529*cdf0e10cSrcweir
1530*cdf0e10cSrcweir        mAnalysis.IssuesCountArray(CID_FUNCTIONS) = _
1531*cdf0e10cSrcweir                mAnalysis.IssuesCountArray(CID_FUNCTIONS) + 1
1532*cdf0e10cSrcweir    End With
1533*cdf0e10cSrcweir
1534*cdf0e10cSrcweir    mAnalysis.Issues.Add myIssue
1535*cdf0e10cSrcweir
1536*cdf0e10cSrcweirFinalExit:
1537*cdf0e10cSrcweir    Set myIssue = Nothing
1538*cdf0e10cSrcweir    Exit Sub
1539*cdf0e10cSrcweirHandleErrors:
1540*cdf0e10cSrcweir    WriteDebug currentFunctionName & " : " & mAnalysis.name & ": " & Err.Number & " " & Err.Description & " " & Err.Source
1541*cdf0e10cSrcweirEnd Sub
1542*cdf0e10cSrcweir
1543*cdf0e10cSrcweirSub Analyze_Password_Protection(aWB As Workbook)
1544*cdf0e10cSrcweir    On Error GoTo HandleErrors
1545*cdf0e10cSrcweir    Dim currentFunctionName As String
1546*cdf0e10cSrcweir    currentFunctionName = "Analyze_Password_Protection"
1547*cdf0e10cSrcweir    Dim myIssue As IssueInfo
1548*cdf0e10cSrcweir    Set myIssue = New IssueInfo
1549*cdf0e10cSrcweir
1550*cdf0e10cSrcweir    If aWB.HasPassword Or aWB.WriteReserved Then
1551*cdf0e10cSrcweir        With myIssue
1552*cdf0e10cSrcweir            .IssueID = CID_CONTENT_AND_DOCUMENT_PROPERTIES
1553*cdf0e10cSrcweir            .IssueType = RID_STR_COMMON_ISSUE_CONTENT_AND_DOCUMENT_PROPERTIES
1554*cdf0e10cSrcweir            .SubType = RID_STR_COMMON_SUBISSUE_PASSWORDS_PROTECTION
1555*cdf0e10cSrcweir
1556*cdf0e10cSrcweir            .IssueTypeXML = CSTR_ISSUE_CONTENT_DOCUMENT_PROPERTIES
1557*cdf0e10cSrcweir            .SubTypeXML = CSTR_SUBISSUE_PASSWORD_PROTECTION
1558*cdf0e10cSrcweir            .locationXML = .CLocationWorkBook
1559*cdf0e10cSrcweir
1560*cdf0e10cSrcweir            .Location = .CLocationWorkBook
1561*cdf0e10cSrcweir
1562*cdf0e10cSrcweir            If aWB.HasPassword Then
1563*cdf0e10cSrcweir                .Attributes.Add RID_STR_EXCEL_ATTRIBUTE_PASSWORD_TO_OPEN
1564*cdf0e10cSrcweir                .Values.Add RID_STR_EXCEL_ATTRIBUTE_SET
1565*cdf0e10cSrcweir            End If
1566*cdf0e10cSrcweir            If aWB.WriteReserved Then
1567*cdf0e10cSrcweir            .Attributes.Add RID_STR_EXCEL_ATTRIBUTE_PASSWORD_TO_MODIFY
1568*cdf0e10cSrcweir            .Values.Add RID_STR_EXCEL_ATTRIBUTE_SET
1569*cdf0e10cSrcweir            End If
1570*cdf0e10cSrcweir
1571*cdf0e10cSrcweir            mAnalysis.IssuesCountArray(CID_CONTENT_AND_DOCUMENT_PROPERTIES) = _
1572*cdf0e10cSrcweir                    mAnalysis.IssuesCountArray(CID_CONTENT_AND_DOCUMENT_PROPERTIES) + 1
1573*cdf0e10cSrcweir        End With
1574*cdf0e10cSrcweir
1575*cdf0e10cSrcweir        mAnalysis.Issues.Add myIssue
1576*cdf0e10cSrcweir    End If
1577*cdf0e10cSrcweir
1578*cdf0e10cSrcweirFinalExit:
1579*cdf0e10cSrcweir    Set myIssue = Nothing
1580*cdf0e10cSrcweir    Exit Sub
1581*cdf0e10cSrcweirHandleErrors:
1582*cdf0e10cSrcweir    WriteDebug currentFunctionName & " : " & mAnalysis.name & ": " & Err.Number & " " & Err.Description & " " & Err.Source
1583*cdf0e10cSrcweir    Resume FinalExit
1584*cdf0e10cSrcweirEnd Sub
1585*cdf0e10cSrcweir
1586*cdf0e10cSrcweirSub SetDocProperties(docAnalysis As DocumentAnalysis, wb As Workbook, fso As FileSystemObject)
1587*cdf0e10cSrcweir    On Error GoTo HandleErrors
1588*cdf0e10cSrcweir    Dim currentFunctionName As String
1589*cdf0e10cSrcweir    currentFunctionName = "SetProperties"
1590*cdf0e10cSrcweir    Dim f As File
1591*cdf0e10cSrcweir    Set f = fso.GetFile(docAnalysis.name)
1592*cdf0e10cSrcweir
1593*cdf0e10cSrcweir    Const appPropertyAppName = 9
1594*cdf0e10cSrcweir    Const appPropertyLastAuthor = 7
1595*cdf0e10cSrcweir    Const appPropertyRevision = 8
1596*cdf0e10cSrcweir    Const appPropertyTemplate = 6
1597*cdf0e10cSrcweir    Const appPropertyTimeCreated = 11
1598*cdf0e10cSrcweir    Const appPropertyTimeLastSaved = 12
1599*cdf0e10cSrcweir
1600*cdf0e10cSrcweir    On Error Resume Next
1601*cdf0e10cSrcweir    docAnalysis.PageCount = wb.Sheets.count
1602*cdf0e10cSrcweir    docAnalysis.Created = f.DateCreated
1603*cdf0e10cSrcweir    docAnalysis.Modified = f.DateLastModified
1604*cdf0e10cSrcweir    docAnalysis.Accessed = f.DateLastAccessed
1605*cdf0e10cSrcweir    docAnalysis.Printed = DateValue("01/01/1900")
1606*cdf0e10cSrcweir    On Error GoTo HandleErrors
1607*cdf0e10cSrcweir
1608*cdf0e10cSrcweir    On Error Resume Next 'Some apps may not support all props
1609*cdf0e10cSrcweir    docAnalysis.Application = getAppSpecificApplicationName & " " & Application.Version
1610*cdf0e10cSrcweir    'docAnalysis.Application = wb.BuiltinDocumentProperties(appPropertyAppName)
1611*cdf0e10cSrcweir    'If InStr(docAnalysis.Application, "Microsoft") = 1 Then
1612*cdf0e10cSrcweir    '    docAnalysis.Application = Mid(docAnalysis.Application, Len("Microsoft") + 2)
1613*cdf0e10cSrcweir    'End If
1614*cdf0e10cSrcweir    'If InStr(Len(docAnalysis.Application) - 2, docAnalysis.Application, ".") = 0 Then
1615*cdf0e10cSrcweir    '    docAnalysis.Application = docAnalysis.Application & " " & Application.Version
1616*cdf0e10cSrcweir    'End If
1617*cdf0e10cSrcweir
1618*cdf0e10cSrcweir    docAnalysis.SavedBy = _
1619*cdf0e10cSrcweir        wb.BuiltinDocumentProperties(appPropertyLastAuthor)
1620*cdf0e10cSrcweir    docAnalysis.Revision = _
1621*cdf0e10cSrcweir        val(wb.BuiltinDocumentProperties(appPropertyRevision))
1622*cdf0e10cSrcweir    docAnalysis.Template = _
1623*cdf0e10cSrcweir        fso.GetFileName(wb.BuiltinDocumentProperties(appPropertyTemplate))
1624*cdf0e10cSrcweir    docAnalysis.Modified = _
1625*cdf0e10cSrcweir        wb.BuiltinDocumentProperties(appPropertyTimeLastSaved)
1626*cdf0e10cSrcweir
1627*cdf0e10cSrcweirFinalExit:
1628*cdf0e10cSrcweir    Set f = Nothing
1629*cdf0e10cSrcweir    Exit Sub
1630*cdf0e10cSrcweir
1631*cdf0e10cSrcweirHandleErrors:
1632*cdf0e10cSrcweir    WriteDebug currentFunctionName & " : " & mAnalysis.name & ": " & Err.Number & " " & Err.Description & " " & Err.Source
1633*cdf0e10cSrcweir    Resume FinalExit
1634*cdf0e10cSrcweirEnd Sub
1635*cdf0e10cSrcweir
1636*cdf0e10cSrcweirSub Analyze_OLEEmbedded(wrkSheet As Worksheet)
1637*cdf0e10cSrcweir    On Error GoTo HandleErrors
1638*cdf0e10cSrcweir    Dim currentFunctionName As String
1639*cdf0e10cSrcweir    currentFunctionName = "Analyze_OLEEmbedded"
1640*cdf0e10cSrcweir
1641*cdf0e10cSrcweir    ' Handle Shapes
1642*cdf0e10cSrcweir    Dim aShape As Shape
1643*cdf0e10cSrcweir    For Each aShape In wrkSheet.Shapes
1644*cdf0e10cSrcweir        Analyze_OLEEmbeddedSingleShape mAnalysis, aShape, wrkSheet.name
1645*cdf0e10cSrcweir        Analyze_Lines mAnalysis, aShape, wrkSheet.name
1646*cdf0e10cSrcweir        Analyze_Transparency mAnalysis, aShape, wrkSheet.name
1647*cdf0e10cSrcweir        Analyze_Gradients mAnalysis, aShape, wrkSheet.name
1648*cdf0e10cSrcweir    Next aShape
1649*cdf0e10cSrcweir
1650*cdf0e10cSrcweir    Exit Sub
1651*cdf0e10cSrcweir
1652*cdf0e10cSrcweirHandleErrors:
1653*cdf0e10cSrcweir    WriteDebug currentFunctionName & " : " & mAnalysis.name & ": " & Err.Number & " " & Err.Description & " " & Err.Source
1654*cdf0e10cSrcweirEnd Sub
1655*cdf0e10cSrcweir
1656*cdf0e10cSrcweirSub Analyze_Workbook_Protection(aWB As Workbook)
1657*cdf0e10cSrcweir    On Error GoTo HandleErrors
1658*cdf0e10cSrcweir    Dim currentFunctionName As String
1659*cdf0e10cSrcweir    currentFunctionName = "Analyze_Workbook_Protection"
1660*cdf0e10cSrcweir    Dim myIssue As IssueInfo
1661*cdf0e10cSrcweir    Set myIssue = New IssueInfo
1662*cdf0e10cSrcweir    Dim bProtectSharing As Boolean
1663*cdf0e10cSrcweir    Dim bProtectStructure As Boolean
1664*cdf0e10cSrcweir    Dim bProtectWindows As Boolean
1665*cdf0e10cSrcweir
1666*cdf0e10cSrcweir    bProtectSharing = False
1667*cdf0e10cSrcweir    bProtectStructure = False
1668*cdf0e10cSrcweir    bProtectWindows = False
1669*cdf0e10cSrcweir
1670*cdf0e10cSrcweir    If Not WorkbookProtectTest(aWB, bProtectSharing, bProtectStructure, bProtectWindows) Then
1671*cdf0e10cSrcweir        GoTo FinalExit
1672*cdf0e10cSrcweir    End If
1673*cdf0e10cSrcweir
1674*cdf0e10cSrcweir    Set myIssue = New IssueInfo
1675*cdf0e10cSrcweir    With myIssue
1676*cdf0e10cSrcweir        .IssueID = CID_CONTENT_AND_DOCUMENT_PROPERTIES
1677*cdf0e10cSrcweir        .IssueType = RID_STR_COMMON_ISSUE_CONTENT_AND_DOCUMENT_PROPERTIES
1678*cdf0e10cSrcweir        .SubType = RID_STR_EXCEL_SUBISSUE_WORKBOOK_PROTECTION
1679*cdf0e10cSrcweir        .Location = .CLocationWorkBook
1680*cdf0e10cSrcweir
1681*cdf0e10cSrcweir        .IssueTypeXML = CSTR_ISSUE_CONTENT_DOCUMENT_PROPERTIES
1682*cdf0e10cSrcweir        .SubTypeXML = CSTR_SUBISSUE_WORKBOOK_PROTECTION
1683*cdf0e10cSrcweir        .locationXML = .CXMLLocationWorkBook
1684*cdf0e10cSrcweir
1685*cdf0e10cSrcweir        If bProtectSharing Then
1686*cdf0e10cSrcweir            .Attributes.Add RID_STR_EXCEL_ATTRIBUTE_PROTECT_TYPE_SHARING
1687*cdf0e10cSrcweir            .Values.Add RID_STR_EXCEL_ATTRIBUTE_SET
1688*cdf0e10cSrcweir        End If
1689*cdf0e10cSrcweir        If bProtectStructure Then
1690*cdf0e10cSrcweir            .Attributes.Add RID_STR_EXCEL_ATTRIBUTE_PROTECT_TYPE_STRUCTURE
1691*cdf0e10cSrcweir            .Values.Add RID_STR_EXCEL_ATTRIBUTE_SET
1692*cdf0e10cSrcweir        End If
1693*cdf0e10cSrcweir        If bProtectWindows Then
1694*cdf0e10cSrcweir            .Attributes.Add RID_STR_EXCEL_ATTRIBUTE_PROTECT_TYPE_WINDOWS
1695*cdf0e10cSrcweir            .Values.Add RID_STR_EXCEL_ATTRIBUTE_SET
1696*cdf0e10cSrcweir        End If
1697*cdf0e10cSrcweir
1698*cdf0e10cSrcweir        AddIssueDetailsNote myIssue, 0, RID_STR_EXCEL_NOTE_PASSWORD_TO_OPEN
1699*cdf0e10cSrcweir        mAnalysis.IssuesCountArray(CID_CONTENT_AND_DOCUMENT_PROPERTIES) = _
1700*cdf0e10cSrcweir                mAnalysis.IssuesCountArray(CID_CONTENT_AND_DOCUMENT_PROPERTIES) + 1
1701*cdf0e10cSrcweir    End With
1702*cdf0e10cSrcweir
1703*cdf0e10cSrcweir    mAnalysis.Issues.Add myIssue
1704*cdf0e10cSrcweir
1705*cdf0e10cSrcweirFinalExit:
1706*cdf0e10cSrcweir    Set myIssue = Nothing
1707*cdf0e10cSrcweir    Exit Sub
1708*cdf0e10cSrcweir
1709*cdf0e10cSrcweirHandleErrors:
1710*cdf0e10cSrcweir    WriteDebug currentFunctionName & " : " & mAnalysis.name & ": " & Err.Number & " " & Err.Description & " " & Err.Source
1711*cdf0e10cSrcweir    Resume FinalExit
1712*cdf0e10cSrcweir
1713*cdf0e10cSrcweirEnd Sub
1714*cdf0e10cSrcweir
1715*cdf0e10cSrcweirPrivate Function WorkbookProtectTest(aWB As Workbook, bProtectSharing As Boolean, _
1716*cdf0e10cSrcweir    bProtectStructure As Boolean, bProtectWindows As Boolean) As Boolean
1717*cdf0e10cSrcweir    On Error GoTo HandleErrors
1718*cdf0e10cSrcweir    Dim currentFunctionName As String
1719*cdf0e10cSrcweir    currentFunctionName = "WorkbookProtectTest"
1720*cdf0e10cSrcweir
1721*cdf0e10cSrcweir    WorkbookProtectTest = False
1722*cdf0e10cSrcweir
1723*cdf0e10cSrcweir    On Error Resume Next 'Simulate Try Catch
1724*cdf0e10cSrcweir    aWB.UnprotectSharing sharingPassword:=" "
1725*cdf0e10cSrcweir    If Err.Number = 1004 Then
1726*cdf0e10cSrcweir        bProtectSharing = True
1727*cdf0e10cSrcweir    ElseIf Err.Number <> 0 Then
1728*cdf0e10cSrcweir        Resume HandleErrors
1729*cdf0e10cSrcweir    End If
1730*cdf0e10cSrcweir    On Error GoTo HandleErrors
1731*cdf0e10cSrcweir
1732*cdf0e10cSrcweir    On Error Resume Next 'Simulate Try Catch
1733*cdf0e10cSrcweir    aWB.Unprotect Password:=""
1734*cdf0e10cSrcweir    If Err.Number = 1004 Then
1735*cdf0e10cSrcweir        If aWB.ProtectStructure = True Then
1736*cdf0e10cSrcweir            bProtectStructure = True
1737*cdf0e10cSrcweir        End If
1738*cdf0e10cSrcweir        If aWB.ProtectWindows = True Then
1739*cdf0e10cSrcweir            bProtectWindows = True
1740*cdf0e10cSrcweir        End If
1741*cdf0e10cSrcweir    End If
1742*cdf0e10cSrcweir
1743*cdf0e10cSrcweir    If bProtectSharing Or bProtectStructure Or bProtectWindows Then
1744*cdf0e10cSrcweir        WorkbookProtectTest = True
1745*cdf0e10cSrcweir    End If
1746*cdf0e10cSrcweirFinalExit:
1747*cdf0e10cSrcweir    Exit Function
1748*cdf0e10cSrcweir
1749*cdf0e10cSrcweirHandleErrors:
1750*cdf0e10cSrcweir    WriteDebug currentFunctionName & " : " & mAnalysis.name & ": " & Err.Number & " " & Err.Description & " " & Err.Source
1751*cdf0e10cSrcweir    Resume FinalExit
1752*cdf0e10cSrcweir
1753*cdf0e10cSrcweirEnd Function
1754*cdf0e10cSrcweir
1755*cdf0e10cSrcweirPrivate Sub Class_Initialize()
1756*cdf0e10cSrcweir    Set mAnalysis = New DocumentAnalysis
1757*cdf0e10cSrcweirEnd Sub
1758*cdf0e10cSrcweirPrivate Sub Class_Terminate()
1759*cdf0e10cSrcweir    Set mAnalysis = Nothing
1760*cdf0e10cSrcweirEnd Sub
1761*cdf0e10cSrcweir
1762*cdf0e10cSrcweirPublic Property Get Results() As DocumentAnalysis
1763*cdf0e10cSrcweir    Set Results = mAnalysis
1764*cdf0e10cSrcweirEnd Property
1765*cdf0e10cSrcweirPrivate Function FormatIssueComplex(myChart As Chart, bDataTable As Boolean, bXAxes As Boolean) As Boolean
1766*cdf0e10cSrcweir    On Error GoTo HandleErrors
1767*cdf0e10cSrcweir    Dim currentFunctionName As String
1768*cdf0e10cSrcweir    currentFunctionName = "FormatIssueComplex"
1769*cdf0e10cSrcweir
1770*cdf0e10cSrcweir    bXAxes = False
1771*cdf0e10cSrcweir
1772*cdf0e10cSrcweir    If myChart.HasDataTable Then
1773*cdf0e10cSrcweir        bDataTable = True
1774*cdf0e10cSrcweir    End If
1775*cdf0e10cSrcweir    If Not (IsPie(myChart) Or myChart.ChartType = xlDoughnut Or myChart.ChartType = xlBubble3DEffect) Then
1776*cdf0e10cSrcweir        If myChart.HasAxis(1) Then
1777*cdf0e10cSrcweir            If myChart.Axes(1).CategoryType = xlTimeScale Or myChart.Axes(1).CategoryType = xlAutomaticScale Then
1778*cdf0e10cSrcweir                bXAxes = True
1779*cdf0e10cSrcweir            End If
1780*cdf0e10cSrcweir        End If
1781*cdf0e10cSrcweir    End If
1782*cdf0e10cSrcweir    If bDataTable Or bXAxes Then
1783*cdf0e10cSrcweir        FormatIssueComplex = True
1784*cdf0e10cSrcweir    End If
1785*cdf0e10cSrcweir    Exit Function
1786*cdf0e10cSrcweirHandleErrors:
1787*cdf0e10cSrcweir    WriteDebug currentFunctionName & " : " & mAnalysis.name & ": " & Err.Number & " " & Err.Description & " " & Err.Source
1788*cdf0e10cSrcweirEnd Function
1789*cdf0e10cSrcweir
1790*cdf0e10cSrcweirPrivate Function IsAreaChart(myChart As Chart) As Boolean
1791*cdf0e10cSrcweir
1792*cdf0e10cSrcweir    If (myChart.ChartType = xlArea Or myChart.ChartType = xl3DArea Or _
1793*cdf0e10cSrcweir        myChart.ChartType = xlAreaStacked Or _
1794*cdf0e10cSrcweir        myChart.ChartType = xl3DAreaStacked Or _
1795*cdf0e10cSrcweir        myChart.ChartType = xlAreaStacked100 Or _
1796*cdf0e10cSrcweir        myChart.ChartType = xl3DAreaStacked100) _
1797*cdf0e10cSrcweir    Then
1798*cdf0e10cSrcweir        IsAreaChart = True
1799*cdf0e10cSrcweir    Else
1800*cdf0e10cSrcweir        IsAreaChart = False
1801*cdf0e10cSrcweir    End If
1802*cdf0e10cSrcweir
1803*cdf0e10cSrcweirEnd Function
1804*cdf0e10cSrcweir
1805*cdf0e10cSrcweirPrivate Function FormatissueMinor(myChart As Chart, bUnsupportedType As Boolean, bTrendline As Boolean, bDatalabelWithLegend As Boolean, bLegendPosition As Boolean, bTitleFont As Boolean, bPiechartDirection As Boolean, bAxisInterval As Boolean) As Boolean
1806*cdf0e10cSrcweirOn Error GoTo HandleErrors
1807*cdf0e10cSrcweirDim currentFunctionName As String
1808*cdf0e10cSrcweircurrentFunctionName = "FormatissueMinor"
1809*cdf0e10cSrcweir
1810*cdf0e10cSrcweirDim ctype As Integer
1811*cdf0e10cSrcweirDim fsize As Integer
1812*cdf0e10cSrcweirDim se As Series
1813*cdf0e10cSrcweirDim dl As DataLabel
1814*cdf0e10cSrcweir
1815*cdf0e10cSrcweir    FormatissueMinor = False
1816*cdf0e10cSrcweir    ctype = myChart.ChartType
1817*cdf0e10cSrcweir
1818*cdf0e10cSrcweir    If (ctype = xlBubble Or ctype = xlPieOfPie Or ctype = xl3DPieExploded _
1819*cdf0e10cSrcweir        Or ctype = xlRadarFilled Or ctype = xlBubble3DEffect _
1820*cdf0e10cSrcweir        Or ctype = xlRadarMarkers Or ctype = xlRadar Or ctype = xlBarOfPie _
1821*cdf0e10cSrcweir        Or ctype = xlXYScatter Or ctype = xlXYScatterLines Or ctype = xlXYScatterLinesNoMarkers _
1822*cdf0e10cSrcweir        Or ctype = xlXYScatterSmooth Or ctype = xlXYScatterSmoothNoMarkers _
1823*cdf0e10cSrcweir        Or ctype = xlSurface Or ctype = xlSurfaceTopView Or ctype = xlSurfaceTopViewWireframe _
1824*cdf0e10cSrcweir        Or ctype = xlSurfaceWireframe) Then
1825*cdf0e10cSrcweir        bUnsupportedType = True
1826*cdf0e10cSrcweir    End If
1827*cdf0e10cSrcweir
1828*cdf0e10cSrcweir    For Each se In myChart.SeriesCollection
1829*cdf0e10cSrcweir        On Error Resume Next ' may not have trendlines property
1830*cdf0e10cSrcweir        If se.Trendlines.count <> 0 Then
1831*cdf0e10cSrcweir            If Err.Number = 0 Then
1832*cdf0e10cSrcweir            bTrendline = True
1833*cdf0e10cSrcweir            End If
1834*cdf0e10cSrcweir        End If
1835*cdf0e10cSrcweir        If se.HasDataLabels Then
1836*cdf0e10cSrcweir            If Err.Number = 0 Then
1837*cdf0e10cSrcweir                If (IsAreaChart(myChart)) Then
1838*cdf0e10cSrcweir                    For Each dl In se.DataLabels
1839*cdf0e10cSrcweir                        If dl.ShowLegendKey = True Then
1840*cdf0e10cSrcweir                            bDatalabelWithLegend = True
1841*cdf0e10cSrcweir                            Exit For
1842*cdf0e10cSrcweir                        End If
1843*cdf0e10cSrcweir                    Next dl
1844*cdf0e10cSrcweir                Else
1845*cdf0e10cSrcweir                    Dim pt As Point
1846*cdf0e10cSrcweir                    For Each pt In se.Points
1847*cdf0e10cSrcweir                        If pt.HasDataLabel Then
1848*cdf0e10cSrcweir                            If pt.DataLabel.ShowLegendKey Then
1849*cdf0e10cSrcweir                                bDatalabelWithLegend = True
1850*cdf0e10cSrcweir                                Exit For
1851*cdf0e10cSrcweir                            End If
1852*cdf0e10cSrcweir                        End If
1853*cdf0e10cSrcweir                    Next pt
1854*cdf0e10cSrcweir                End If
1855*cdf0e10cSrcweir            End If
1856*cdf0e10cSrcweir        End If
1857*cdf0e10cSrcweir        On Error GoTo HandleErrors
1858*cdf0e10cSrcweir        If bTrendline And bDatalabelWithLegend Then
1859*cdf0e10cSrcweir           Exit For
1860*cdf0e10cSrcweir        End If
1861*cdf0e10cSrcweir    Next se
1862*cdf0e10cSrcweir
1863*cdf0e10cSrcweir    If myChart.HasLegend Then
1864*cdf0e10cSrcweir        Dim legPos As Long
1865*cdf0e10cSrcweir        On Error Resume Next 'If legend moved accessing position will fail
1866*cdf0e10cSrcweir        legPos = myChart.Legend.Position
1867*cdf0e10cSrcweir
1868*cdf0e10cSrcweir        If (Err.Number <> 0) Or (legPos <> xlLegendPositionRight) Then
1869*cdf0e10cSrcweir            bLegendPosition = True
1870*cdf0e10cSrcweir        End If
1871*cdf0e10cSrcweir        On Error GoTo HandleErrors
1872*cdf0e10cSrcweir    End If
1873*cdf0e10cSrcweir
1874*cdf0e10cSrcweir    If IsPie(myChart) Then
1875*cdf0e10cSrcweir        bPiechartDirection = True
1876*cdf0e10cSrcweir    ElseIf myChart.ChartType <> xlDoughnut And myChart.ChartType <> xlBubble3DEffect Then
1877*cdf0e10cSrcweir        If myChart.HasAxis(xlValue, xlPrimary) Then
1878*cdf0e10cSrcweir            With myChart.Axes(xlValue, xlPrimary)
1879*cdf0e10cSrcweir                If .MajorUnitIsAuto And .MaximumScaleIsAuto And .MinimumScaleIsAuto And .MinorUnitIsAuto Then
1880*cdf0e10cSrcweir                    bAxisInterval = True
1881*cdf0e10cSrcweir                End If
1882*cdf0e10cSrcweir            End With
1883*cdf0e10cSrcweir        End If
1884*cdf0e10cSrcweir    End If
1885*cdf0e10cSrcweir
1886*cdf0e10cSrcweir    On Error Resume Next 'If title has mixed font size accessing Font.Size will fail - Title mixed font issue
1887*cdf0e10cSrcweir    If myChart.HasTitle Then
1888*cdf0e10cSrcweir        fsize = myChart.chartTitle.Font.Size
1889*cdf0e10cSrcweir        If Err.Number = FontError Then
1890*cdf0e10cSrcweir            bTitleFont = True
1891*cdf0e10cSrcweir        End If
1892*cdf0e10cSrcweir    End If
1893*cdf0e10cSrcweir
1894*cdf0e10cSrcweir    On Error GoTo HandleErrors
1895*cdf0e10cSrcweir    If bUnsupportedType Or bTrendline Or bDatalabelWithLegend Or bLegendPosition Or bTitleFont Or bPiechartDirection Or bAxisInterval Then
1896*cdf0e10cSrcweir        FormatissueMinor = True
1897*cdf0e10cSrcweir    End If
1898*cdf0e10cSrcweir
1899*cdf0e10cSrcweirFinalExit:
1900*cdf0e10cSrcweir
1901*cdf0e10cSrcweir    Set se = Nothing
1902*cdf0e10cSrcweir    Set dl = Nothing
1903*cdf0e10cSrcweir    Exit Function
1904*cdf0e10cSrcweir
1905*cdf0e10cSrcweirHandleErrors:
1906*cdf0e10cSrcweir
1907*cdf0e10cSrcweir    WriteDebug currentFunctionName & " : " & mAnalysis.name & ": " & Err.Number & " " & Err.Description & " " & Err.Source
1908*cdf0e10cSrcweir    Resume FinalExit
1909*cdf0e10cSrcweir
1910*cdf0e10cSrcweirEnd Function
1911*cdf0e10cSrcweir
1912*cdf0e10cSrcweirPrivate Function SeriesIssue(myChart As Chart, bSeriesChartTypeChanged As Boolean, bDatasourceNotLinkedtoCell As Boolean, bDatasourceOnDifferentSheet As Boolean, bCategoryandValue As Boolean, bCLabelMorethanOneCell As Boolean, bOneColumnRow As Boolean) As Boolean
1913*cdf0e10cSrcweirOn Error GoTo HandleErrors
1914*cdf0e10cSrcweirDim currentFunctionName As String
1915*cdf0e10cSrcweircurrentFunctionName = "SeriesIssue"
1916*cdf0e10cSrcweirSeriesIssue = False
1917*cdf0e10cSrcweir
1918*cdf0e10cSrcweirDim Num As Integer
1919*cdf0e10cSrcweirDim I As Integer
1920*cdf0e10cSrcweirDim i2 As Integer
1921*cdf0e10cSrcweirDim formula As String
1922*cdf0e10cSrcweirDim p1 As Integer, p2 As Integer
1923*cdf0e10cSrcweirDim b1 As Integer, b2 As Integer
1924*cdf0e10cSrcweirDim comma1 As Integer, comma2 As Integer
1925*cdf0e10cSrcweirDim starty As Integer
1926*cdf0e10cSrcweirDim ctype As Integer
1927*cdf0e10cSrcweirDim temp As Integer
1928*cdf0e10cSrcweirDim myarray() As String
1929*cdf0e10cSrcweirDim Values(3), sh
1930*cdf0e10cSrcweirDim chartseries As Series
1931*cdf0e10cSrcweirDim b As Boolean
1932*cdf0e10cSrcweirDim bmorecolumns As Boolean
1933*cdf0e10cSrcweirDim c As Boolean
1934*cdf0e10cSrcweir
1935*cdf0e10cSrcweirbmorecolumns = False
1936*cdf0e10cSrcweirNum = myChart.SeriesCollection.count
1937*cdf0e10cSrcweir
1938*cdf0e10cSrcweirIf (Num = 0) Then Exit Function
1939*cdf0e10cSrcweir
1940*cdf0e10cSrcweirctype = myChart.SeriesCollection(1).ChartType
1941*cdf0e10cSrcweirI = 0
1942*cdf0e10cSrcweirsh = ""
1943*cdf0e10cSrcweir
1944*cdf0e10cSrcweirReDim Preserve myarray(Num, 3)
1945*cdf0e10cSrcweir
1946*cdf0e10cSrcweirIf IsPie(myChart) And Num > 1 Then  'if pie chart has more than one series,set series number to 1
1947*cdf0e10cSrcweir        bmorecolumns = True
1948*cdf0e10cSrcweir        Num = 1
1949*cdf0e10cSrcweirEnd If
1950*cdf0e10cSrcweirFor Each chartseries In myChart.SeriesCollection
1951*cdf0e10cSrcweir    On Error Resume Next
1952*cdf0e10cSrcweir    formula = chartseries.formula
1953*cdf0e10cSrcweir    If Err.Number <> 0 Then
1954*cdf0e10cSrcweir        GoTo FinalExit
1955*cdf0e10cSrcweir    End If
1956*cdf0e10cSrcweir    If Not bSeriesChartTypeChanged Then  'check if the chart type changed
1957*cdf0e10cSrcweir        temp = chartseries.ChartType
1958*cdf0e10cSrcweir        If temp <> ctype Then
1959*cdf0e10cSrcweir            bSeriesChartTypeChanged = True
1960*cdf0e10cSrcweir        End If
1961*cdf0e10cSrcweir    End If
1962*cdf0e10cSrcweir
1963*cdf0e10cSrcweir    'get each part of the formula, if it is a single range, set the value to the array
1964*cdf0e10cSrcweir    p1 = InStr(1, formula, "(")
1965*cdf0e10cSrcweir    comma1 = InStr(1, formula, ",")
1966*cdf0e10cSrcweir    Values(0) = Mid(formula, p1 + 1, comma1 - p1 - 1)
1967*cdf0e10cSrcweir
1968*cdf0e10cSrcweir    If Mid(formula, comma1 + 1, 1) = "(" Then
1969*cdf0e10cSrcweir'       Multiple ranges
1970*cdf0e10cSrcweir        bDatasourceNotLinkedtoCell = True
1971*cdf0e10cSrcweir        GoTo FinalExit
1972*cdf0e10cSrcweir    Else
1973*cdf0e10cSrcweir        If Mid(formula, comma1 + 1, 1) = "{" Then
1974*cdf0e10cSrcweir'           Literal Array
1975*cdf0e10cSrcweir            bDatasourceNotLinkedtoCell = True
1976*cdf0e10cSrcweir            GoTo FinalExit
1977*cdf0e10cSrcweir        Else
1978*cdf0e10cSrcweir'          A single range
1979*cdf0e10cSrcweir            comma2 = InStr(comma1 + 1, formula, ",")
1980*cdf0e10cSrcweir            Values(1) = Mid(formula, comma1 + 1, comma2 - comma1 - 1)
1981*cdf0e10cSrcweir            starty = comma2
1982*cdf0e10cSrcweir        End If
1983*cdf0e10cSrcweir    End If
1984*cdf0e10cSrcweir
1985*cdf0e10cSrcweir    If Mid(formula, starty + 1, 1) = "(" Then
1986*cdf0e10cSrcweir'       Multiple ranges
1987*cdf0e10cSrcweir        bDatasourceNotLinkedtoCell = True
1988*cdf0e10cSrcweir        GoTo FinalExit
1989*cdf0e10cSrcweir    Else
1990*cdf0e10cSrcweir        If Mid(formula, starty + 1, 1) = "{" Then
1991*cdf0e10cSrcweir'           Literal Array
1992*cdf0e10cSrcweir            bDatasourceNotLinkedtoCell = True
1993*cdf0e10cSrcweir            GoTo FinalExit
1994*cdf0e10cSrcweir        Else
1995*cdf0e10cSrcweir'          A single range
1996*cdf0e10cSrcweir            comma1 = starty
1997*cdf0e10cSrcweir            comma2 = InStr(comma1 + 1, formula, ",")
1998*cdf0e10cSrcweir            Values(2) = Mid(formula, comma1 + 1, comma2 - comma1 - 1)
1999*cdf0e10cSrcweir        End If
2000*cdf0e10cSrcweir    End If
2001*cdf0e10cSrcweir
2002*cdf0e10cSrcweir    If SheetCheck(sh, Values) Then      'check if data from different sheet
2003*cdf0e10cSrcweir        bDatasourceOnDifferentSheet = True
2004*cdf0e10cSrcweir        GoTo FinalExit
2005*cdf0e10cSrcweir    End If
2006*cdf0e10cSrcweir
2007*cdf0e10cSrcweir    For i2 = 0 To 2   'set data to myarray, if it is range, assign the range address, else null
2008*cdf0e10cSrcweir        If IsRange(Values(i2)) Then
2009*cdf0e10cSrcweir            myarray(I, i2) = Range(Values(i2)).Address
2010*cdf0e10cSrcweir        'ElseIf (Not IsRange(values(i2))) And values(i2) <> "" Then
2011*cdf0e10cSrcweir        '    bDatasourceNotLinkedtoCell = True
2012*cdf0e10cSrcweir        '    myarray(i, i2) = ""
2013*cdf0e10cSrcweir        Else
2014*cdf0e10cSrcweir            bDatasourceNotLinkedtoCell = True
2015*cdf0e10cSrcweir            myarray(I, i2) = ""
2016*cdf0e10cSrcweir        End If
2017*cdf0e10cSrcweir    Next i2
2018*cdf0e10cSrcweir
2019*cdf0e10cSrcweir    I = I + 1
2020*cdf0e10cSrcweir    If bmorecolumns Then 'if it is pie chart, exit
2021*cdf0e10cSrcweir        Exit For
2022*cdf0e10cSrcweir    End If
2023*cdf0e10cSrcweirNext chartseries
2024*cdf0e10cSrcweir
2025*cdf0e10cSrcweir
2026*cdf0e10cSrcweirc = DataCheck(myarray, Num, bCategoryandValue, bCLabelMorethanOneCell, bOneColumnRow) 'check data values and category of the chart
2027*cdf0e10cSrcweir
2028*cdf0e10cSrcweirFinalExit:
2029*cdf0e10cSrcweirIf bSeriesChartTypeChanged Or bDatasourceNotLinkedtoCell Or bDatasourceOnDifferentSheet Or bCategoryandValue Or bCLabelMorethanOneCell Or bOneColumnRow Then
2030*cdf0e10cSrcweir    SeriesIssue = True
2031*cdf0e10cSrcweirEnd If
2032*cdf0e10cSrcweir
2033*cdf0e10cSrcweirLast:
2034*cdf0e10cSrcweir    Set chartseries = Nothing
2035*cdf0e10cSrcweir    Exit Function
2036*cdf0e10cSrcweir
2037*cdf0e10cSrcweirHandleErrors:
2038*cdf0e10cSrcweir    WriteDebug currentFunctionName & " : " & mAnalysis.name & ": " & Err.Number & " " & Err.Description & " " & Err.Source
2039*cdf0e10cSrcweir    Resume Last
2040*cdf0e10cSrcweirEnd Function
2041*cdf0e10cSrcweir
2042*cdf0e10cSrcweirPrivate Function DataCheck(myarray() As String, Num As Integer, bCategoryandValue As Boolean, bCLabelMorethanOneCell As Boolean, bOneColumnRow As Boolean)
2043*cdf0e10cSrcweirOn Error GoTo HandleErrors
2044*cdf0e10cSrcweirDim currentFunctionName As String
2045*cdf0e10cSrcweircurrentFunctionName = "DataCheck"
2046*cdf0e10cSrcweir
2047*cdf0e10cSrcweirDim s1() As String
2048*cdf0e10cSrcweirDim v1() As String
2049*cdf0e10cSrcweirDim v2() As String
2050*cdf0e10cSrcweirDim c1() As String
2051*cdf0e10cSrcweirDim c2() As String
2052*cdf0e10cSrcweirDim bs1isrange As Boolean
2053*cdf0e10cSrcweirDim bc1isrange As Boolean
2054*cdf0e10cSrcweirDim bc2isrange As Boolean
2055*cdf0e10cSrcweirDim j As Integer
2056*cdf0e10cSrcweirDim I As Integer
2057*cdf0e10cSrcweirDim btemp1 As Boolean
2058*cdf0e10cSrcweirDim btemp2 As Boolean
2059*cdf0e10cSrcweir
2060*cdf0e10cSrcweir
2061*cdf0e10cSrcweirbs1isrange = True
2062*cdf0e10cSrcweirbc1isrange = True
2063*cdf0e10cSrcweirbc2isrange = True
2064*cdf0e10cSrcweir
2065*cdf0e10cSrcweirIf myarray(0, 1) = "" Then
2066*cdf0e10cSrcweir    bs1isrange = False
2067*cdf0e10cSrcweirElse
2068*cdf0e10cSrcweir    s1 = SplitRange(myarray(0, 1))
2069*cdf0e10cSrcweir    If UBound(s1) < 4 Then
2070*cdf0e10cSrcweir        bOneColumnRow = True
2071*cdf0e10cSrcweir        GoTo FinalExit
2072*cdf0e10cSrcweir    End If
2073*cdf0e10cSrcweir    If (Asclong(s1(0)) <> Asclong(s1(2))) And (Asclong(s1(1)) <> Asclong(s1(3))) Then
2074*cdf0e10cSrcweir        bCLabelMorethanOneCell = True
2075*cdf0e10cSrcweir        GoTo FinalExit
2076*cdf0e10cSrcweir    End If
2077*cdf0e10cSrcweir
2078*cdf0e10cSrcweirEnd If
2079*cdf0e10cSrcweir
2080*cdf0e10cSrcweirIf myarray(0, 0) = "" Then
2081*cdf0e10cSrcweir    ReDim c1(2)
2082*cdf0e10cSrcweir    bc1isrange = False
2083*cdf0e10cSrcweir    c1(0) = ""
2084*cdf0e10cSrcweir    c1(1) = ""
2085*cdf0e10cSrcweirElse
2086*cdf0e10cSrcweir    If InStr(1, myarray(0, 0), ":") <> 0 Then
2087*cdf0e10cSrcweir        bCLabelMorethanOneCell = True
2088*cdf0e10cSrcweir        GoTo FinalExit
2089*cdf0e10cSrcweir    End If
2090*cdf0e10cSrcweir    c1 = SplitRange(myarray(0, 0))
2091*cdf0e10cSrcweirEnd If
2092*cdf0e10cSrcweirv1 = SplitRange(myarray(0, 2))
2093*cdf0e10cSrcweir
2094*cdf0e10cSrcweirIf bs1isrange Then
2095*cdf0e10cSrcweir    btemp1 = s1(0) = s1(2) And s1(1) = v1(1) And s1(3) = v1(3) And Asclong(v1(0)) >= Asclong(s1(0)) + 1 'category beside first column
2096*cdf0e10cSrcweir    btemp2 = s1(1) = s1(3) And s1(0) = v1(0) And s1(2) = v1(2) And Asclong(v1(1)) >= Asclong(s1(1)) + 1 'category beside first row
2097*cdf0e10cSrcweir    If (Not btemp1) And (Not btemp2) Then
2098*cdf0e10cSrcweir        bCategoryandValue = True
2099*cdf0e10cSrcweir        GoTo FinalExit
2100*cdf0e10cSrcweir    End If
2101*cdf0e10cSrcweirEnd If
2102*cdf0e10cSrcweirIf bc1isrange Then
2103*cdf0e10cSrcweir    btemp1 = v1(0) = v1(2) And c1(0) = v1(0) And Asclong(c1(1)) <= Asclong(v1(1)) - 1 'data label beside row
2104*cdf0e10cSrcweir    btemp2 = v1(1) = v1(3) And c1(1) = v1(1) And Asclong(c1(0)) <= Asclong(v1(0)) - 1 'data label beside column
2105*cdf0e10cSrcweir    If (Not btemp1) And (Not btemp2) Then
2106*cdf0e10cSrcweir        bCategoryandValue = True
2107*cdf0e10cSrcweir        GoTo FinalExit
2108*cdf0e10cSrcweir    End If
2109*cdf0e10cSrcweirEnd If
2110*cdf0e10cSrcweirFor I = 1 To Num - 1
2111*cdf0e10cSrcweir    If myarray(I, 0) = "" Then
2112*cdf0e10cSrcweir        ReDim c2(2)
2113*cdf0e10cSrcweir        c2(0) = ""
2114*cdf0e10cSrcweir        c2(1) = ""
2115*cdf0e10cSrcweir        bc2isrange = False
2116*cdf0e10cSrcweir    Else
2117*cdf0e10cSrcweir        If InStr(1, myarray(0, 1), ":") = 0 Then
2118*cdf0e10cSrcweir            bCLabelMorethanOneCell = True
2119*cdf0e10cSrcweir            GoTo FinalExit
2120*cdf0e10cSrcweir        End If
2121*cdf0e10cSrcweir        c2 = SplitRange(myarray(I, 0))
2122*cdf0e10cSrcweir    End If
2123*cdf0e10cSrcweir    v2 = SplitRange(myarray(I, 2))
2124*cdf0e10cSrcweir    If bc2isrange Then
2125*cdf0e10cSrcweir        btemp1 = v1(0) = v1(2) And c2(0) = v2(0) And Asclong(c2(1)) <= Asclong(v2(1)) - 1 'data label beside row
2126*cdf0e10cSrcweir        btemp2 = v2(1) = v2(3) And c2(1) = v2(1) And Asclong(c2(0)) <= Asclong(v2(0)) - 1 'data label beside column
2127*cdf0e10cSrcweir        If (Not btemp1) And (Not btemp2) Then
2128*cdf0e10cSrcweir            bCategoryandValue = True
2129*cdf0e10cSrcweir            GoTo FinalExit
2130*cdf0e10cSrcweir            'break
2131*cdf0e10cSrcweir        End If
2132*cdf0e10cSrcweir    End If
2133*cdf0e10cSrcweir    If bc1isrange And bc2isrange Then
2134*cdf0e10cSrcweir        'series data beside last series data in column and data label beside last series data label
2135*cdf0e10cSrcweir        btemp1 = v2(0) = v2(2) And Asclong(c2(0)) = Asclong(c1(0)) + 1 And c2(1) = c1(1) And Asclong(v2(0)) = Asclong(v1(0)) + 1 And v1(1) = v2(1) And v1(3) = v2(3)
2136*cdf0e10cSrcweir        'series data beside last series data in row and data label beside laast series data label
2137*cdf0e10cSrcweir        btemp2 = v2(1) = v2(3) And c1(0) = c2(0) And Asclong(c2(1)) = Asclong(c1(1)) + 1 And Asclong(v2(1)) = Asclong(v1(1)) + 1 And v1(0) = v2(0) And v1(2) = v2(2)
2138*cdf0e10cSrcweir        If (Not btemp1) And (Not btemp2) Then
2139*cdf0e10cSrcweir            bCategoryandValue = True
2140*cdf0e10cSrcweir            GoTo FinalExit
2141*cdf0e10cSrcweir        End If
2142*cdf0e10cSrcweir    ElseIf Not bc2isrange Then
2143*cdf0e10cSrcweir        btemp1 = v2(0) = v2(2) And Asclong(v2(0)) = Asclong(v1(0)) + 1 And v1(1) = v2(1) And v1(3) = v2(3) 'series data beside last series data  in column
2144*cdf0e10cSrcweir        btemp2 = v2(1) = v2(3) And Asclong(v2(1)) = Asclong(v1(1)) + 1 And v1(0) = v2(0) And v1(2) = v2(2) 'series data beside last series data in row
2145*cdf0e10cSrcweir        If (Not btemp1) And (Not btemp2) Then
2146*cdf0e10cSrcweir            bCategoryandValue = True
2147*cdf0e10cSrcweir            GoTo FinalExit
2148*cdf0e10cSrcweir        End If
2149*cdf0e10cSrcweir    End If
2150*cdf0e10cSrcweir        For j = 0 To 1
2151*cdf0e10cSrcweir            c1(j) = c2(j)
2152*cdf0e10cSrcweir        Next j
2153*cdf0e10cSrcweir        For j = 0 To 3
2154*cdf0e10cSrcweir            v1(j) = v2(j)
2155*cdf0e10cSrcweir        Next j
2156*cdf0e10cSrcweir        bc1isrange = bc2isrange
2157*cdf0e10cSrcweir        bc2isrange = True
2158*cdf0e10cSrcweir
2159*cdf0e10cSrcweirNext I
2160*cdf0e10cSrcweirFinalExit:
2161*cdf0e10cSrcweirExit Function
2162*cdf0e10cSrcweirHandleErrors:
2163*cdf0e10cSrcweir    WriteDebug currentFunctionName & " : " & mAnalysis.name & ": " & Err.Number & " " & Err.Description & " " & Err.Source
2164*cdf0e10cSrcweirEnd Function
2165*cdf0e10cSrcweirPrivate Function SplitRange(a As String) As String()
2166*cdf0e10cSrcweirOn Error GoTo HandleErrors
2167*cdf0e10cSrcweirDim currentFunctionName As String
2168*cdf0e10cSrcweircurrentFunctionName = "SplitRange"
2169*cdf0e10cSrcweir
2170*cdf0e10cSrcweirDim c1 As Integer, c2 As Integer, c3 As Integer
2171*cdf0e10cSrcweirDim start As Integer
2172*cdf0e10cSrcweirDim l As Integer
2173*cdf0e10cSrcweirDim rearray() As String
2174*cdf0e10cSrcweir
2175*cdf0e10cSrcweirstart = 2
2176*cdf0e10cSrcweirIf a <> "" Then
2177*cdf0e10cSrcweir    l = InStr(1, a, ":")
2178*cdf0e10cSrcweir    If l = 0 Then
2179*cdf0e10cSrcweir        ReDim rearray(2)
2180*cdf0e10cSrcweir        c1 = InStr(start, a, "$")
2181*cdf0e10cSrcweir        rearray(0) = Mid(a, start, c1 - start)
2182*cdf0e10cSrcweir        rearray(1) = Mid(a, c1 + 1, Len(a) - c1)
2183*cdf0e10cSrcweir    Else
2184*cdf0e10cSrcweir        ReDim rearray(4)
2185*cdf0e10cSrcweir        c1 = InStr(start, a, "$")
2186*cdf0e10cSrcweir        rearray(0) = Mid(a, start, c1 - start)
2187*cdf0e10cSrcweir        c2 = InStr(c1 + 1, a, "$")
2188*cdf0e10cSrcweir        rearray(1) = Mid(a, c1 + 1, c2 - c1 - 2)
2189*cdf0e10cSrcweir        c3 = InStr(c2 + 1, a, "$")
2190*cdf0e10cSrcweir        rearray(2) = Mid(a, c2 + 1, c3 - c2 - 1)
2191*cdf0e10cSrcweir        rearray(3) = Mid(a, c3 + 1, Len(a) - c3)
2192*cdf0e10cSrcweir    End If
2193*cdf0e10cSrcweirElse
2194*cdf0e10cSrcweir    ReDim rearray(4)
2195*cdf0e10cSrcweir    rearray(0) = ""
2196*cdf0e10cSrcweir    rearray(1) = ""
2197*cdf0e10cSrcweir    rearray(2) = ""
2198*cdf0e10cSrcweir    rearray(3) = ""
2199*cdf0e10cSrcweirEnd If
2200*cdf0e10cSrcweirSplitRange = rearray
2201*cdf0e10cSrcweir
2202*cdf0e10cSrcweirExit Function
2203*cdf0e10cSrcweirHandleErrors:
2204*cdf0e10cSrcweir    WriteDebug currentFunctionName & " : " & mAnalysis.name & ": " & Err.Number & " " & Err.Description & " " & Err.Source
2205*cdf0e10cSrcweirEnd Function
2206*cdf0e10cSrcweirPrivate Function Asclong(s As String) As Integer
2207*cdf0e10cSrcweirOn Error GoTo HandleErrors
2208*cdf0e10cSrcweirDim currentFunctionName As String
2209*cdf0e10cSrcweircurrentFunctionName = "Asclong"
2210*cdf0e10cSrcweirAsclong = 0
2211*cdf0e10cSrcweir
2212*cdf0e10cSrcweirDim l As Integer
2213*cdf0e10cSrcweirDim I As Integer
2214*cdf0e10cSrcweirDim m As String
2215*cdf0e10cSrcweir
2216*cdf0e10cSrcweirl = Len(s)
2217*cdf0e10cSrcweir
2218*cdf0e10cSrcweirFor I = 1 To l
2219*cdf0e10cSrcweir    m = Mid(s, I, 1)
2220*cdf0e10cSrcweir    Asclong = Asclong + Asc(m)
2221*cdf0e10cSrcweirNext I
2222*cdf0e10cSrcweirExit Function
2223*cdf0e10cSrcweir
2224*cdf0e10cSrcweirHandleErrors:
2225*cdf0e10cSrcweir    WriteDebug currentFunctionName & " : " & mAnalysis.name & ": " & Err.Number & " " & Err.Description & " " & Err.Source
2226*cdf0e10cSrcweirEnd Function
2227*cdf0e10cSrcweirPrivate Function SheetCheck(sh As Variant, Values() As Variant) As Boolean
2228*cdf0e10cSrcweirOn Error GoTo HandleErrors
2229*cdf0e10cSrcweirDim currentFunctionName As String
2230*cdf0e10cSrcweircurrentFunctionName = "SheetCheck"
2231*cdf0e10cSrcweirSheetCheck = False
2232*cdf0e10cSrcweir
2233*cdf0e10cSrcweirDim c1 As Integer
2234*cdf0e10cSrcweirDim I As Integer
2235*cdf0e10cSrcweir
2236*cdf0e10cSrcweirDim temp
2237*cdf0e10cSrcweir
2238*cdf0e10cSrcweirFor I = 0 To 2
2239*cdf0e10cSrcweir    If IsRange(Values(I)) Then
2240*cdf0e10cSrcweir        c1 = InStr(1, Values(I), "!")
2241*cdf0e10cSrcweir        If sh = "" Then
2242*cdf0e10cSrcweir            sh = Mid(Values(I), 1, c1 - 1)
2243*cdf0e10cSrcweir            temp = Mid(Values(I), 1, c1 - 1)
2244*cdf0e10cSrcweir        Else
2245*cdf0e10cSrcweir            temp = Mid(Values(I), 1, c1 - 1)
2246*cdf0e10cSrcweir        End If
2247*cdf0e10cSrcweir        If temp <> sh Then
2248*cdf0e10cSrcweir            SheetCheck = True
2249*cdf0e10cSrcweir            Exit Function
2250*cdf0e10cSrcweir        End If
2251*cdf0e10cSrcweir    End If
2252*cdf0e10cSrcweirNext I
2253*cdf0e10cSrcweirExit Function
2254*cdf0e10cSrcweir
2255*cdf0e10cSrcweirHandleErrors:
2256*cdf0e10cSrcweir    WriteDebug currentFunctionName & " : " & mAnalysis.name & ": " & Err.Number & " " & Err.Description & " " & Err.Source
2257*cdf0e10cSrcweirEnd Function
2258*cdf0e10cSrcweirPrivate Function IsRange(Ref) As Boolean
2259*cdf0e10cSrcweirOn Error GoTo HandleErrors
2260*cdf0e10cSrcweirDim currentFunctionName As String
2261*cdf0e10cSrcweircurrentFunctionName = "IsRange"
2262*cdf0e10cSrcweir
2263*cdf0e10cSrcweirDim x As Range
2264*cdf0e10cSrcweir
2265*cdf0e10cSrcweirOn Error Resume Next
2266*cdf0e10cSrcweirSet x = Range(Ref)
2267*cdf0e10cSrcweirIf Err = 0 Then
2268*cdf0e10cSrcweir    IsRange = True
2269*cdf0e10cSrcweirElse
2270*cdf0e10cSrcweir    IsRange = False
2271*cdf0e10cSrcweirEnd If
2272*cdf0e10cSrcweirFinalExit:
2273*cdf0e10cSrcweir    Set x = Nothing
2274*cdf0e10cSrcweir    Exit Function
2275*cdf0e10cSrcweir
2276*cdf0e10cSrcweirHandleErrors:
2277*cdf0e10cSrcweir    WriteDebug currentFunctionName & " : " & mAnalysis.name & ": " & Err.Number & " " & Err.Description & " " & Err.Source
2278*cdf0e10cSrcweir    Resume FinalExit
2279*cdf0e10cSrcweirEnd Function
2280*cdf0e10cSrcweirPrivate Function IsPie(myChart As Chart) As Boolean
2281*cdf0e10cSrcweirOn Error GoTo HandleErrors
2282*cdf0e10cSrcweirDim currentFunctionName As String
2283*cdf0e10cSrcweircurrentFunctionName = "IsPie"
2284*cdf0e10cSrcweirDim ctype As Integer
2285*cdf0e10cSrcweir    IsPie = False
2286*cdf0e10cSrcweir
2287*cdf0e10cSrcweir    ctype = myChart.ChartType
2288*cdf0e10cSrcweir    If (ctype = xlPie) Or _
2289*cdf0e10cSrcweir        (ctype = xlPieExploded) Or _
2290*cdf0e10cSrcweir        (ctype = xlPieOfPie) Or _
2291*cdf0e10cSrcweir        (ctype = xl3DPie) Or _
2292*cdf0e10cSrcweir        (ctype = xl3DPieExploded) Then
2293*cdf0e10cSrcweir
2294*cdf0e10cSrcweir        IsPie = True
2295*cdf0e10cSrcweir    End If
2296*cdf0e10cSrcweir    Exit Function
2297*cdf0e10cSrcweir
2298*cdf0e10cSrcweirHandleErrors:
2299*cdf0e10cSrcweir    WriteDebug currentFunctionName & " : " & mAnalysis.name & ": " & Err.Number & " " & Err.Description & " " & Err.Source
2300*cdf0e10cSrcweirEnd Function
2301*cdf0e10cSrcweir
2302*cdf0e10cSrcweirPrivate Function IsOldVersion(aFormat As XlFileFormat) As Boolean
2303*cdf0e10cSrcweir    Dim theResult As Boolean
2304*cdf0e10cSrcweir    Dim currentFunctionName As String
2305*cdf0e10cSrcweir    currentFunctionName = "IsOldVersion"
2306*cdf0e10cSrcweir
2307*cdf0e10cSrcweir    Select Case aFormat
2308*cdf0e10cSrcweir    Case xlExcel2, xlExcel2FarEast, xlExcel3, xlExcel4, xlExcel4Workbook, xlExcel5, xlExcel7
2309*cdf0e10cSrcweir        theResult = True
2310*cdf0e10cSrcweir    Case xlExcel9795, xlWorkbookNormal
2311*cdf0e10cSrcweir        theResult = False
2312*cdf0e10cSrcweir    Case Else
2313*cdf0e10cSrcweir        WriteDebug currentFunctionName & " : " & mAnalysis.name & ": The version of this spreadsheet is not recognised"
2314*cdf0e10cSrcweir    End Select
2315*cdf0e10cSrcweir
2316*cdf0e10cSrcweir    IsOldVersion = theResult
2317*cdf0e10cSrcweirEnd Function
2318*cdf0e10cSrcweir
2319*cdf0e10cSrcweir
2320