|
请教各位,如何改变Excel单元格填充颜色?
唉,自己摸索了半天,只能改变字体颜色,代码如下:
'改变Excel的单元格颜色
Public Function QTP_Change_Color(pathway,sheetname,x,y)
Dim srcData,srcDoc,sp1,sp2,num,use,a1,a2,a3
set srcData = CreateObject("Excel.Application")
srcData.Visible = True
set srcDoc = srcData.Workbooks.Open(pathway)
srcDoc.Worksheets(sheetname).Activate
srcDoc.Worksheets(sheetname).Cells(x,y).Font.Color = vbRed '就是这句话
Dim WshShell
Set WshShell=CreateObject("Wscript.Shell")
WshShell.SendKeys "^s"
wait(1)
srcData.Workbooks.Close
Set srcDoc = nothing
Window("text:=Microsoft Excel").Close
End Function
我想改变的是填充颜色,有个什么fillformat.backcolor
但是搞了半天搞不定,请各路高手指点迷经 |
|