View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
K Dales[_2_] K Dales[_2_] is offline
external usenet poster
 
Posts: 1,163
Default Unable to Set Underline Property of Font Class

I see nothing wrong with your code, assuming you have properly assigned the
ExcelSheet object variable and you are properly pointing to the active
worksheet. Possible issues:
- Are you positive that the cell is unprotected at the time you are trying
to make the change?
- Is there anything else happening in the workbook at the time you are
running that line of code that might have the sheet in a temporarily
"uneditable" state?

If you pause your code just before executing the troublesome line, what
happens if you try typing both the .Underline=xlUnderlineStyleSingle and the
..Bold = True in the immediate pane? That way you know you are trying them
under the exact same conditions. I would be surprised if you can set one
font property but not the other under the exact same conditions.


"Sherwood" wrote:

Greetings,

I'm not sure if I'm posting this to the correct newsgroup or not, so feel
free to redirect me to the appropriate place if necessary. At any rate, I am
receiving the error, "Unable to set the underline property of the font class"
in an Access module using the Excel code below:

ExcelSheet.Application.Cells(1, 1).Font.Underline = xlUnderlineStyleSingle

The following line of code "does" work, however:

ExcelSheet.Application.Cells(1, 1).Font.Bold = True

Do you see anything wrong with the way I am attempting to set the underline
property? Thanks in advance!
--
Sherwood