Option Explicit
Dim x(1 To 4, 1 To 5) As IntegerPrivate Sub Command1_Click()
Dim i As Integer
Dim j As Integer
Dim ex As Object
Dim exwbook As Object
Dim exsheet As Object
Set ex = CreateObject("Excel.Application")
Set exwbook = Nothing
Set exsheet = Nothing
Set exwbook = ex.Workbooks().Add
Set exsheet = exwbook.Worksheets("sheet1")
ex.Range("c4:g7").Value = x
ex.Range("c3").Value = "表 格"
ex.Range("d3").Value = " 春 天 "
ex.Range("e3").Value = " 夏 天 "
ex.Range("f3").Value = " 秋 天 "
ex.Range("g3").Value = " 冬 天 "
ex.Range("C3:G7").Select
ex.Selection.Borders(xlDiagonalDown).LineStyle = xlNone
ex.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With ex.Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With ex.Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With ex.Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With ex.Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With ex.Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With ex.Selection.Borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
'保存输入到abc.xls
exwbook.SaveAs "c:\abc.xls"
exwbook.PrintOut '打印
'退出excel
ex.Quit
End Sub
Dim x(1 To 4, 1 To 5) As IntegerPrivate Sub Command1_Click()
Dim i As Integer
Dim j As Integer
Dim ex As Object
Dim exwbook As Object
Dim exsheet As Object
Set ex = CreateObject("Excel.Application")
Set exwbook = Nothing
Set exsheet = Nothing
Set exwbook = ex.Workbooks().Add
Set exsheet = exwbook.Worksheets("sheet1")
ex.Range("c4:g7").Value = x
ex.Range("c3").Value = "表 格"
ex.Range("d3").Value = " 春 天 "
ex.Range("e3").Value = " 夏 天 "
ex.Range("f3").Value = " 秋 天 "
ex.Range("g3").Value = " 冬 天 "
ex.Range("C3:G7").Select
ex.Selection.Borders(xlDiagonalDown).LineStyle = xlNone
ex.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With ex.Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With ex.Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With ex.Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With ex.Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With ex.Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With ex.Selection.Borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
'保存输入到abc.xls
exwbook.SaveAs "c:\abc.xls"
exwbook.PrintOut '打印
'退出excel
ex.Quit
End Sub
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货