中关村在线

首页 排行 新品 问答 下载 论坛 手机 笔记本 数码相机 主板 显卡 平板电脑 更多

关于Word样式导入导出的問題

举报
别人的Word文档中有我想要的样式,我能把它导出来,再导入自己的Word文件中吗
讨论回答 (7)
51154130
dsxcmwuojdxn
cc90516
Private Sub Comma来自nd3_Click()
On Error Resum360问答e Next
Dim irow, icol, count, i A前记新s Integer
Dim irowcount, icolcount As Integer
Dim xlApp As Excel.Application
Dim xlBook As Excel.Workbook
Dim xlSheet As Excel.Worksheet
Dim bl As Boolean
Dim key As Integer
Dim RsUserTemp As Recordset
Dim RsOrderTemp As Recordset
Dim a, b
Dim aa As String
aa = Trim(Now)
Set xlApp = CreateObject("excel.application")
Set xlBook = xlApp.Workbooks.Add
Set xlSheet = xlBook.Worksheets(1)
'If rs.RecordCount < 1 Then
'MsgBox ("Error 没黑有记录")
'Exit Sub
'End If
irowcount = rs.RecordCount
icolcount = 18
count = 0
rs.MoveFirst
For icol = 包己三0 To 2
'xlSheet.Cells(1, 1).Value = "查询数据" '加标头;
Next i倍灯车布李col
xlSheet.Cells(1, 1).Value = "时间" '加标头;
xlSheet.Cells(1, 2).Value = "药开度" '加标头;
xlSheet.Cells(1, 3).Value = "药瞬时流量" '加标头;
xlSheet.Cells(1, 4).Value = "药累计流量" '加标头;
xlSheet.Cells(1, 5).Value = "矿浆浓度" '加标头;
xlSheet.Cells(1, 6).Value = "矿浆流量" '加标头
xlSheet.Cells(1, 7).Value = "酸1开度" '加标头;
xlSheet.Cells(1, 8).Value = "酸1瞬时流量" '加标头;
xlSheet.Cells(1, 9).Value = "酸1累计流量" '加标头
xlSheet.Cells(1, 10).Value = "酸2开度" '加标头;
xlSheet.Cells(1, 11).Value = "酸2瞬时流时矿源量" '加标头;
xlSheet.Cells(1, 12).Value = "酸2累计流量" '加标头
xlSheet.Cells(1, 13).Value = "酸3开度" '加标头;
xlSheet.Cells(1, 14).Val要名殖啊夜存留措成制ue = "酸3瞬时流量" '加标头;
xlSheet.Cells(1, 15).确刚百贵扬六限断些Value = "酸3累计流量" '加标头
xlSheet.Ce刑车现所错无分缩lls(1, 16).Value = "酸4开度" '加标头;
xlSheet.Cells(1, 17).Value = "酸4瞬时流量" '加标头;
xlSheet.Cells(1, 18).Value = "酸4累计流量"
xlSheet.Cells(1, 19).Value = "酸5开度"
xlSheet.Cells(1, 20).Value = "酸5瞬时流量"
xlSheet.Cells(1, 21).Value = "酸5累计流量"
Adodc1.Recordset.MoveFirst
For a = 2 To 200
b = 1
If Not Adodc1.Recordset.EOF Then
xlSheet.Cells(a, b) = Adodc1.Recordset("时间")
xlSheet.Cells(a, b + 1) = Adodc1.Recordset("药开度")
xlSheet.Cells(a, b + 2) = Adodc1.Recordset("药瞬时流量")
xlSheet.Cells(a, b + 3) = Adodc1.Recordset("药累计流量")
xlSheet.Cells(a, b + 4) = Adodc1.Recordset("酸1开度")
xlSheet.Cells(a, b + 5) = Adodc1.Recordset("酸1瞬时流量")
xlSheet.Cells(a, b + 6) = Adodc1.Recordset("酸1累计流量")
xlSheet.Cells(a, b + 7) = Adodc1.Recordset("酸2开度")
xlSheet.Cells(a, b + 8) = Adodc1.Recordset("酸2瞬时流量")
xlSheet.Cells(a, b + 9) = Adodc1.Recordset("酸2累计流量")
xlSheet.Cells(a, b + 10) = Adodc1.Recordset("酸3开度")
xlSheet.Cells(a, b + 11) = Adodc1.Recordset("酸3瞬时流量")
xlSheet.Cells(a, b + 12) = Adodc1.Recordset("酸3累计流量")
xlSheet.Cells(a, b + 13) = Adodc1.Recordset("酸4开度")
xlSheet.Cells(a, b + 14) = Adodc1.Recordset("酸4瞬时流量")
xlSheet.Cells(a, b + 15) = Adodc1.Recordset("酸4累计流量")
xlSheet.Cells(a, b + 16) = Adodc1.Recordset("酸5开度")
xlSheet.Cells(a, b + 17) = Adodc1.Recordset("酸5瞬时流量")
xlSheet.Cells(a, b + 18) = Adodc1.Recordset("酸5累计流量")
Else
Exit For
End If
Adodc1.Recordset.Move 1
Next
rs.MoveFirst
xlSheet.Cells(2, 2).Value = Trim(Text1.Text) & Trim(Text2.Text)
For irow = 0 To irowcount - 1
Set RsUserTemp = New Recordset
RsUserTemp.CursorLocation = adUseClient
RsUserTemp.Open "select * from 状态数据 " _
& "where user0_id=" & rs!user0_id, Cn, adOpenStatic, adLockReadOnly
xlSheet.Cells(irow + 4, 1).Value = count + 1
xlSheet.Cells(irow + 4, 2).Value = RsUserTemp!user0_id
xlSheet.Cells(irow + 4, 3).Value = RsUserTemp!user0_name
xlSheet.Cells(irow + 4, 4).Value = RsUserTemp!Address
xlSheet.Cells(irow + 4, 5).Value = RsUserTemp!callno1
Set RsUserTemp = Nothing
Set RsOrderTemp = New Recordset
RsOrderTemp.CursorLocation = adUseClient
RsOrderTemp.Open "select * from 状态数据 where user0_id = " _

If RsOrderTemp.RecordCount = 0 Then
Else

RsOrderTemp.MoveFirst
Do While (Not RsOrderTemp.EOF)
key = 0
key = Val(Mid(str(RsOrderTemp!Order_Time), 6, 2))
Select Case key
Case 0
Exit Do
Case 1
xlSheet.Cells(irow + 4, 6).Value = RsOrderTemp!Order_Amount
Case 2
xlSheet.Cells(irow + 4, 7).Value = RsOrderTemp!Order_Amount
Case 3
xlSheet.Cells(irow + 4, 8).Value = RsOrderTemp!Order_Amount
Case 4
xlSheet.Cells(irow + 4, 9).Value = RsOrderTemp!Order_Amount
Case 5
xlSheet.Cells(irow + 4, 10).Value = RsOrderTemp!Order_Amount
Case 6
xlSheet.Cells(irow + 4, 11).Value = RsOrderTemp!Order_Amount
Case 7
xlSheet.Cells(irow + 4, 12).Value = RsOrderTemp!Order_Amount
Case 8
xlSheet.Cells(irow + 4, 13).Value = RsOrderTemp!Order_Amount
Case 9
xlSheet.Cells(irow + 4, 14).Value = RsOrderTemp!Order_Amount
Case 10
xlSheet.Cells(irow + 4, 15).Value = RsOrderTemp!Order_Amount
Case 11
xlSheet.Cells(irow + 4, 16).Value = RsOrderTemp!Order_Amount
Case 12
xlSheet.Cells(irow + 4, 17).Value = RsOrderTemp!Order_Amount
End Select
RsOrderTemp.MoveNext
Loop
End If
Set RsOrderTemp = Nothing
count = count + 1
rs.MoveNext
If bl Then '因为第一条记录还未导出所以让指针回滚;
rs.MovePrevious
End If
Next
xlApp.Visible = True
xlBook.Save
Set xlApp = Nothing
End Sub
这是我的一个代码,参考一下吧。。。导出到EXCEL的
qaxbwtulga
aasontang
bb2636199
z290905812
展开查看全部 7 条讨论
相关问题

早期的Word究竟有多难用

6638 浏览 9 回答

Word文档里的内容,不小心全部删了,然后点了保存,文档内容怎么找回来

1066 浏览 5 回答

室友给我发个假word,现在我打开微信里面自己的wrod也会变成这种,这怎么解决啊

989 浏览 4 回答

WOL远程开机尝试失败,请教症结在哪

1260 浏览 4 回答

扩展阅读

藏着你无数黑历史的QQ 早就不止聊天和说说了

评论 3

藏着你无数黑历史的QQ 早就不止聊天和说说了

聊一款性价比超高的锐龙7 8700G台式机

评论 4

聊一款性价比超高的锐龙7 8700G台式机

比亚迪第一/零跑新势力销冠 2025年主流车企全年销量汇总

评论 4

比亚迪第一/零跑新势力销冠 2025年主流车企全年销量汇总

新手装机必看:机箱选购避坑只看这3点就够了

评论 6

新手装机必看:机箱选购避坑只看这3点就够了

学会省出一年压岁钱!手把手教你关闭应用“乱扣费”

评论 8

学会省出一年压岁钱!手把手教你关闭应用“乱扣费”
热门问题

电子发票代码在哪里看

5983 浏览 6 回答

电子发票代码在哪里看

3dmax模型导入真实拍摄的视频

6294 浏览 8 回答

3dmax模型导入真实拍摄的视频

免费韩国漫画在线观看的地址有么?

8068 浏览 5 回答

免费韩国漫画在线观看的地址有么?

中国的国烟、国酒、国烟?是什么??

8428 浏览 7 回答

中国的国烟、国酒、国烟?是什么??

人人视频大规模下架原因解析,永久消失吗?

2979 浏览 5 回答

人人视频大规模下架原因解析,永久消失吗?

华为手机有几个档次 最好 中等 下等 分别是好不好的 怎么一看就清楚的

9721 浏览 4 回答

华为手机有几个档次 最好 中等 下等 分别是好不好的 怎么一看就清楚的

《lofter》网页版登录入口

2264 浏览 6 回答

《lofter》网页版登录入口

冬天,汽车前挡风玻璃上,为何盖上一块布或毯子、被子,什么作用?

9472 浏览 4 回答

冬天,汽车前挡风玻璃上,为何盖上一块布或毯子、被子,什么作用?

事业单位高级工是几级?

2533 浏览 5 回答

事业单位高级工是几级?

新的手机剩余多少电量时充电合适

1965 浏览 4 回答

新的手机剩余多少电量时充电合适
最新问答

送镜框,膜岩1.67,算好价吗

7255 浏览 13 回答

送镜框,膜岩1.67,算好价吗

隐匿贤者人设争议

2239 浏览 6 回答

隐匿贤者人设争议

乡村爱情经典台词回顾

2807 浏览 12 回答

乡村爱情经典台词回顾

第一部手机回忆

4334 浏览 13 回答

第一部手机回忆

超132万人投票选小学班长

7450 浏览 3 回答

超132万人投票选小学班长
举报
举报成功

经过核实后将会做出处理,感谢您为社区和谐做出贡献。

请选择删除原因
删除成功
确定推荐该回答?
推荐成功

更多频道

频道导航
辅助工具