PDA

View Full Version : vba property in lcase



voyagerphoen
01-07-2019, 01:49 AM
In my case it is the property "Name" which appears in lowercase i.e. "name".I have not declared it as variable but it still shows as so.but it successfully runs code. Please help.Here is the code


Sub Oh(chtname As String, chtsheet As String, chtrange As String, chttitle As String, chtaxistitlecategory As String, chtaxistitlevalue As String)


On Error GoTo ErrorHandling


With Charts(chtname)
.ChartType = xlColumnClustered
.HasTitle = True
.ChartTitle.Text = chttitle


.SetSourceData Source:=Sheets(chtsheet).Range(chtrange), PlotBy:=xlRows
.Axes(xlCategory, xlPrimary).HasTitle = True
.Axes(xlCategory, xlPrimary).AxisTitle.Characters.Text = chtaxistitlecategory
.Axes(xlValue, xlPrimary).HasTitle = True
.Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = chtaxistitlevalue
End With
Exit Sub


ErrorHandling:


MsgBox "No charts found create one ?"
Charts.Add
ActiveChart.name = chtname
Resume
End Sub




Sub callOh()
Call Oh("MyChart", "ChSheet", "A1:D9", "ExCh", "Month", "Sales")
End Sub

Aflatoon
01-07-2019, 03:55 AM
You must have used lower case name at some point. If it really bothers you, just type:


Dim Name

somewhere, then delete it.

Paul_Hossler
01-07-2019, 08:58 AM
I've noticed that the 'all in lower case' happens sometimes, but I've never been able to track down why or have a consistent test case

Let us know if Aflatoon's suggestion works