急求:vb 中excel问题
来源:百度知道 编辑:UC知道 时间:2024/09/28 10:01:22
在vb 下段代码中如何给exlcel表格居中
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")
exsheet.Rows(1).RowHeight = 20
exsheet.Rows(2).RowHeight = 15
exsheet.Columns(1).ColumnWidth = 0.1
exsheet.Columns(2).ColumnWidth = 0.1
还有就是如何利用vb打开excel文件啊,就是打开到excel文件界面
我试了shell(excel.exe “c:\a.xls”)打不开啊
xzp1984 ,excel显示的问题解决了,
但居中还是不行啊,
老提示Cells.HorizontalAlignment属性不能操作
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")
exsheet.Rows(1).RowHeight = 20
exsheet.Rows(2).RowHeight = 15
exsheet.Columns(1).ColumnWidth = 0.1
exsheet.Columns(2).ColumnWidth = 0.1
还有就是如何利用vb打开excel文件啊,就是打开到excel文件界面
我试了shell(excel.exe “c:\a.xls”)打不开啊
xzp1984 ,excel显示的问题解决了,
但居中还是不行啊,
老提示Cells.HorizontalAlignment属性不能操作
居中问题
exsheet.Cells.HorizontalAlignment = xlCenter
exsheet.Cells.VerticalAlignment = xlCenter
打开到excel文件界面问题
在Set ex = CreateObject("Excel.Application") 下加
ex.Visible = True
试试行不行
有问题再联系我
VB中 工程->引用 里面有没有选中Microsoft Excel 版本号 Object Library 呀?