|
我想把一个表中的数据转为EXCEL格式,转出后的格式由VBA来定议,包括字体及表格.但我把在EXCEL中录制的宏加入到ACCESS中时不能运行.请帮助看一看应该怎样做才对.
DoCmd.OutputTo acTable, "TMP_SUM", "MicrosoftExcel(*.xls)", "C:\TMP_SUM.XLS", True, ""
'以下是由EXCEL生成的宏代码
RANGE("A1:E1").Select
Selection.Font.ColorIndex = 5
Selection.Font.ColorIndex = 5
RANGE("A1:E1").Select
With Selection
.horizontalAlignment = xlLeft
.verticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.shrinkToFit = False
.MergeCells = False
End With
With Selection
.horizontalAlignment = xlCenter
.verticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.shrinkToFit = False
.MergeCells = False
End With
'Range("A2:E13").Select
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
With Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
[em01] |
|