操作方法
新建一个excel,然后打开
alt+F11 打开开发工具vba编辑器
点击:插入——模块
输入代码: Sub 字体颜色等() With Range("b2") [b19] = .Font.Size '字体大小 [b20] = .Font.ColorIndex '字体颜色 [b21] = .Interior.ColorIndex '背景颜色 [b22] = .Borders.LineStyle '边框类型 End With End Sub Sub 另一个() Range("a1").Value = 12345 End Sub 此代码随便写,我写这个只不过是实现的时候,大家看起来比较明显,知道有什么效果!
将vba编辑器和excel关掉,记得保存为启用宏的excel
右键点击刚才保存的excel,使用winrar压缩软件打开;(选择打开方式-选择计算机上的程序--选择浏览--找到winrar--双击打开--最后确定用winrar打开)
在电脑上创建一个文件夹:customUI 文件夹里创建CustomUI.xml这个文档。 用记事本打开这个CustomUI.xml; 写入代码: <customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui" > <ribbon startFromScratch="false"> <tabs> <tab id="rxTabCustom19" label="我的牛逼工具" insertBeforeMso="TabHome"> <group id="myGroup4" label=" "> <button id="a1" imageMso="TableExportTableToSharePointList" size="large" label="字体颜色等" supertip="字体颜色等" onAction="字体颜色等"/> <button id="a2" imageMso="HappyFace" size="large" label="另一个" supertip="另一个" onAction="另一个"/> </group> </tab> </tabs> </ribbon> </customUI> 之后保存
将文件夹customUI拖入打开的压缩文档 ;再打开压缩包中的_rels文件夹;将.rels拖到桌面上,右键用记事本打开加入以下代码:Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties" Target="docProps/app.xml"/><Relationship Id="customUIRelID" Type="http://schemas.microsoft.com/office/2006/relationships/ui/extensibility" Target="customUI/CustomUI.xml"/><Relationship Id="rId2" 然后关闭压缩包
然后打开excel 看打效果了吧