没有人会吗?
要出人命了!
要出人命了!
解决方案 »
- 我用VB连SQL,调用存储过程时为什么返回值为-1
- 关于CommonDialog的问题,请帮忙解决啊,在线等!
- 求助 关于ACCESS的映射 在写求助
- 有那位如何能实现标签作得按钮的透明变色,给小弟些启发好么
- 怎样在vb中动态开辟内存呢?就像C++中使用指针一样。
- 数据库问题,给分!!!!(在线)
- 怎样将TreeView中的记录按从上到下的顺序存储到数据库中?
- 谁有切割WAV的函数,模块或DLL都行。。。
- 请大家推荐美观点的日历或者日期控件!
- 在线求救,大神帮忙看下原因,同一编辑内容为什么现在更新就不一样了
- 如何在datagrid上修改,添加,删除记录,如何对ado 模糊查询呀?
- 请问LISTVIEW中显示文件图标+文件名,如何使文件名象WIN 资源管理器那样长的名字分多行显示?
Dim i As Integer
Dim oExcel As Object
Dim oBook As Object
Dim oSheet As Object
Set oExcel = CreateObject("Excel.Application")
Set oBook = oExcel.workbooks.Add
Set oSheet = oBook.Worksheets(1)
oExcel.Visible = True
oSheet.Range("A1:H1").Select
With oExcel.Selection
'.HorizontalAlignment = -4107 '< ------错误从这里开始
.VerticalAlignment = -4108
.WrapText = False
.Orientation = 0
.AddIndent = False
.ShrinkToFit = False
.MergeCells = False
End With' MyMonth = InputBox("请输入Excel文件的月份")' If CInt(MyMonth) < 1 And CInt(MyMonth) > 12 Then
' MsgBox "输入有误!"
' Exit Sub
' End If oExcel.Selection.Merge
' oSheet.Range("A1:H1").Select
oExcel.Selection.FormulaR1C1 = "分类信息查询" With oExcel.ActiveCell.Characters(Start:=1, Length:=20).Font
.Name = "宋体"
.FontStyle = "加粗"
.Size = 18
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = -4142
.ColorIndex = -4105
End With
oSheet.Cells(2, 1).Value = "序号"
oSheet.Cells(2, 2).Value = "姓名"
oSheet.Cells(2, 3).Value = "身份证号码"
oSheet.Cells(2, 4).Value = "工资总额"
oSheet.Cells(2, 5).Value = "个人比例"
oSheet.Cells(2, 6).Value = "单位比例"
oSheet.Cells(2, 7).Value = "累积余额"
oSheet.Cells(2, 8).Value = "工资性质" oSheet.Columns("A:A").ColumnWidth = 4
oSheet.Columns("B:B").ColumnWidth = 8
oSheet.Columns("C:C").ColumnWidth = 18
oSheet.Columns("D:D").ColumnWidth = 8
oSheet.Columns("E:E").ColumnWidth = 8
oSheet.Columns("F:F").ColumnWidth = 8
oSheet.Columns("G:G").ColumnWidth = 10
oSheet.Columns("H:H").ColumnWidth = 8 For i = 3 To RSObj.RecordCount + 2
oSheet.Cells(i, 1).Value = RSObj("xh")
oSheet.Cells(i, 2).Value = RSObj("xm")
oSheet.Cells(i, 3).Value = RSObj("sfz")
oSheet.Cells(i, 4).Value = RSObj("gzze")
oSheet.Cells(i, 5).Value = RSObj("grbl")
oSheet.Cells(i, 6).Value = RSObj("dwbl")
oSheet.Cells(i, 7).Value = RSObj("ljye")
oSheet.Cells(i, 8).Value = RSObj("gzxz")
RSObj.MoveNext
Next
Mystr = "A2:H" & Trim(Str(RSObj.RecordCount + 2)) oSheet.Range(Mystr).Select With oExcel.Selection.Borders(7)
.LineStyle = 1
.Weight = 2
.ColorIndex = -4105
End With
With oExcel.Selection.Borders(8)
.LineStyle = 1
.Weight = 1
.ColorIndex = -4105
End With
With oExcel.Selection.Borders(9)
.LineStyle = 1
.Weight = 1
.ColorIndex = -4105
End With
With oExcel.Selection.Borders(10)
.LineStyle = 1
.Weight = 1
.ColorIndex = -4105
End With
With oExcel.Selection.Borders(11)
.LineStyle = 1
.Weight = 1
.ColorIndex = -4105
End With
With oExcel.Selection.Borders(12)
.LineStyle = 1
.Weight = 1 - 4105
End With
oSheet.Range("E:E").NumberFormatLocal = "0.00"
oSheet.Range("F:F").NumberFormatLocal = "0.00"
oSheet.Range("G:G").NumberFormatLocal = "0.00"' oBook.SaveAs "D:\BaguijinWork\baguijin\gjj\Book2.xls"
'************
'* 打印预览 *
'************
oSheet.PrintPreview
'oSheet.PrintOut
oExcel.Quit
Set oSheet = Nothing
Set oBook = Nothing
Set oExcel = Nothing