//open excel,f_path is path for the file
form run_excel using f_path.
data: application type ole2_object, "OLE Object for ExcelApplication
workbook type ole2_object. "OLE Object for ExcelWorkbook
create object application 'EXCEL.APPLICATION'.
set property of application 'visible' = 1.
call method of application 'Workbooks' = workbook.
call method of workbook 'Open'
exporting #1 = f_path.
free object application.
endform.
form run_excel using f_path.
data: application type ole2_object, "OLE Object for ExcelApplication
workbook type ole2_object. "OLE Object for ExcelWorkbook
create object application 'EXCEL.APPLICATION'.
set property of application 'visible' = 1.
call method of application 'Workbooks' = workbook.
call method of workbook 'Open'
exporting #1 = f_path.
free object application.
endform.
使用VBA打开Excel文件
本文介绍了一种通过VBA代码来打开Excel文件的方法。具体步骤包括:创建一个Excel应用程序对象,设置该对象的可见性,打开指定路径的Excel工作簿。
4万+

被折叠的 条评论
为什么被折叠?



