一个execl初雪者的问题,怎样给一个单元格画线?关键是要动态显示

jcdwin4 2003-09-14 06:40:56
我的程序是这样的
With rstserver
If .State = adStateOpen Then .Close
.ActiveConnection = gcnnReport
.CursorLocation = adUseServer
.CursorType = adOpenDynamic
.LockType = adLockOptimistic
.Source = "select * from gsgl_gl "
.Open
.MoveFirst
irow = 4
icol = 7
While Not .EOF
icol = icol - 5
strselect = "e" & Trim(Str(irow)) & ":d" & Trim(Str(irow))
MyXL.Sheets("sheet1").Range(strselect).Select
MyXL.Sheets("sheet1").Range(strselect).Activate
MyXL.Sheets("sheet1").Cells(irow, icol) = .Fields("date")
icol = icol + 1
MyXL.Sheets("sheet1").Cells(irow, icol) = .Fields("times")
'为获取事故地点,关连事故发生的站名
dd = .Fields("station_name") & "站" & .Fields("direction_name") & "方向" & .Fields("mark") & "k"
icol = icol + 1
MyXL.Sheets("sheet1").Cells(irow, icol) = dd
icol = icol + 1
MyXL.Sheets("sheet1").Cells(irow, icol) = .Fields("type_name")
icol = icol + 1
MyXL.Sheets("sheet1").Cells(irow, icol) = .Fields("summary")
icol = icol + 1
MyXL.Sheets("sheet1").Cells(irow, icol) = .Fields("remark")
.MoveNext
irow = irow + 1

Wend
End With

我现在已经能数据能插入到excel里了,我想在插入数据的同时也能给数据画上表格,应该怎么做呢
...全文
388 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
jiangchuandong 2003-10-27
  • 打赏
  • 举报
回复
up
jcdwin4 2003-09-15
  • 打赏
  • 举报
回复
问题已经解决了,送分~~~~
jcdwin4 2003-09-14
  • 打赏
  • 举报
回复
我看了一段程序是这样写的
With xlSheet
.Range(.Cells(1, 1), .Cells(1, Icolcount)).Font.Name = "黑体"
'设标题为黑体字
.Range(.Cells(1, 1), .Cells(1, Icolcount)).Font.Bold = True
'标题字体加粗
.Range(.Cells(1, 1), .Cells(Irowcount + 1, Icolcount)).Borders.LineStyle = xlContinuous
'设表格边框样式
End With
应该把这个写在那里呢?

588

社区成员

发帖
与我相关
我的任务
社区描述
提出问题
其他 技术论坛(原bbs)
社区管理员
  • community_281
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧