当前位置: 代码迷 >> VFP >> 无法设置excel批注的字体解决思路
  详细解决方案

无法设置excel批注的字体解决思路

热度:2046   发布时间:2013-02-26 00:00:00.0
无法设置excel批注的字体
ole=createobject( "excel.application ")
......
ole.range( "a3 ").comment.Font.Bold=.f.
该句出错,提示:OLE   错误码   0x80020006   UnKnown   name
查阅vba帮助,comment对象就没有font属性,可是在excel中能设置,记录的宏为:

Sub   宏1()
        Range( "A3 ").Select
        Range( "A3 ").Comment.Text   Text:= "这里填批注文本 "
        Selection.Font.Bold   =   False
End   Sub
咋办?


------解决方案--------------------------------------------------------
设置字体
eole.ActiveSheet.Cells(2,1).Font.Name= "黑体 "

设置字体大小
eole.ActiveSheet.Cells(1,1).Font.Size=25

设置字体为斜体
eole.ActiveSheet.Cells(1,1).Font.Italic=.t.

设置整列字体为粗体
eole.ActiveSheet.Columns(1).Font.Bold=.t.

设置字体为粗体
eole.ActiveSheet.Cells(1).Font.Bold=.t.

eole.ActiveSheet.Range( "A3 ").Font.Bold=.t.


------解决方案--------------------------------------------------------
1、你的EXCEL版本,在2000中无法设置;
2、从你的代码来看,是设置单元格的格式。
  相关解决方案