利用VB如何 读取和设置 Excel中表单的 单元格格式 利用VB如何 读取和设置 Excel中表单的 单元格格式希望高手们不吝赐教! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 先在Excel中用宏记录一下不就知道了 比如我要设置单元格的文本控制为自动换行,有边框等等!则代码如下: With Selection .HorizontalAlignment = xlGeneral .VerticalAlignment = xlBottom .WrapText = True .Orientation = 0 .AddIndent = False .ShrinkToFit = False .MergeCells = False End With Selection.Borders(xlDiagonalDown).LineStyle = xlNone Selection.Borders(xlDiagonalUp).LineStyle = xlNone With Selection.Borders(xlEdgeLeft) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With With Selection.Borders(xlEdgeTop) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With With Selection.Borders(xlEdgeBottom) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With With Selection.Borders(xlEdgeRight) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With代码很简单,怎么得来的,就是楼上所说用excel的宏生成的! 你只需要学习一下EXCEL生成的宏代码就全都会了. 如果已知单元格的格式,用VB创建Excel,又如何设置刚刚生成的Excel表单中单元格的格式呢? 先在Excel中录制宏看一下代码稍为改动就可以用到VB中 关于EDB数据库的问题请教高手 treeview的选中节点处于可编辑状态 DAT文件分析 我想用vb做一个浏览器,但是有的网站有插件才能看,怎样把别人的插件一起做进去? 编辑? 请问:怎么把ACCESS的数据导到SQL 2000的服务器上啊 请教一个关于窗体界面设计的问题?? 烦啊,谁有....? 一个关于日期的问题 我写的DLL,在win2000下vb程序调用的很好,为什么在win98-me就报错呀 VB + SQL 读取图片问题,急!在线高分等! 关于如何调用水晶报表crystal report8.0 ?万分着急!一定给分!
则代码如下: With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom
.WrapText = True
.Orientation = 0
.AddIndent = False
.ShrinkToFit = False
.MergeCells = False
End With
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
代码很简单,怎么得来的,就是楼上所说用excel的宏生成的!
先在Excel中录制宏看一下代码稍为改动就可以用到VB中