In message <
[email protected]> of
Wed, 23 May 2012 23:57:36 in microsoft.public.excel.programming,
blueflash said:
Thanks for your reply.
I typed in the statement and checked that it was exactly how it was in
the code.
I am trying to change the font name for a data label on a chart.
Arial is available as I can use that font when changing manually.
The program always stops at this line with runtime error 1004
Unable to set the name property of the font class.
a few lines of code above the stopping point are:
[snip]
ActiveChart.SeriesCollection(2).Points(7).DataLabel.Select
Selection.Characters.Text = "90 "
Selection.Characters(Start:=2, Length:=5).Font.Name = "Arial"
I am still looking for a USP to persuade me to move to excel 2007.
I constructed a minimal VBA module which works in 2003.
I tried porting it to 2007.
I found help on "run a macro useful".
I found I had no Developer tab.
I clicked the Microsoft Office Button [I found it at the top left hand
corner of my excel window] and "Excel Options". I checked "Show
Developer tab in the Ribbon" and "OK", but got "The server drafts
location you entered for offline editing is not valid or you do not have
permission to access that location. Specify a location on your local
computer."
Googling suggests using Options Save.
"Server drafts location" was empty and browsing for one selected the
drive containing my .xls file. I chose C:\temp\ServerDraftLocation.
That did not fix my problem.
Some how or other, I could live with it and successfully ran the
following code:
Option Explicit
Sub aaMacro1()
Cells(1, 1) = "Hello world"
Cells(1, 1).Font.Name = "Comic Sans" ' Maybe not needed?
Cells(1, 1).Select
Selection.Characters(Start:=2, Length:=5).Font.Name = "Arial"
End Sub
I suggest you do a binary chop between my code and yours to get the
simplest piece of stand-alone code which shows the problem.
Then post that code. Others may then solve it for you.
Alternatively, post a workbook on a site which allows that sort of thing
and a reference to the file with instructions on running it.