怎么用VB新建一个excell表,谢谢指教! 我用Commondialog控件显示"另存为"对话框,输入文件名后后按"保存",并没有新建一个excell表,我要怎么新建一个excell表. 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 Dim ExcelApp As Excel.ApplicationDim ExcelBook As Excel.WorkbookDim ExcelSheet As Excel.WorksheetSet ExcelApp = CreateObject("excel.application") '创建EXCEL句柄ExcelApp.Visible = False 'Set ExcelBook = ExcelApp.Workbooks.Add '创建EXCEL工作薄Set ExcelSheet = ExcelBook.Worksheets(1) '创建EXCEL工作表ExcelSheet.Cells(1, 1).Value = "编号"ExcelSheet.Cells(1, 2).Value = "单位名称"ExcelSheet.Cells(1, 3).Value = "负责人"ExcelSheet.Cells(1, 4).Value = "单位地址"ExcelSheet.Cells(1, 5).Value = "类别"ExcelSheet.Cells(1, 6).Value = "许可项目"ExcelSheet.Cells(1, 7).Value = "区域"ExcelSheet.Cells(1, 8).Value = "乡镇"ExcelSheet.Cells(1, 9).Value = "发证日期"ExcelSheet.Cells(1, 10).Value = "截止日期"ExcelSheet.Range("A2").CopyFromRecordset rsExcelBook.SaveAs strExcelPath + "临时卫生许可证报表"ExcelApp.Visible = True这些代码看一下,就会了。 谢谢,我基本懂了,可是我发现如果:Set ExcelSheet = ExcelBook.Worksheets(4) 它就会说超出范围,我该怎么访问>3的工作表呢? 关于开机自动换墙纸的问题,不成功!! 如何将“模块”文件恢复为“窗体”文件 11 请教一个关于vaSpread表格的基础问题。 急,在线等,各位高手进来看看啊 怎样才能让窗体提前出来?? 菜鸟级问题,没分了,请大家帮帮忙!! 请问VB6里WebBrowser可以获得和传递页面里的数据 如何按组合键2次? Internet Transfer 控件如何使用? vb窗体界面的实现,高手请进 排序问题
Dim ExcelBook As Excel.Workbook
Dim ExcelSheet As Excel.Worksheet
Set ExcelApp = CreateObject("excel.application") '创建EXCEL句柄
ExcelApp.Visible = False '
Set ExcelBook = ExcelApp.Workbooks.Add '创建EXCEL工作薄
Set ExcelSheet = ExcelBook.Worksheets(1) '创建EXCEL工作表
ExcelSheet.Cells(1, 1).Value = "编号"
ExcelSheet.Cells(1, 2).Value = "单位名称"
ExcelSheet.Cells(1, 3).Value = "负责人"
ExcelSheet.Cells(1, 4).Value = "单位地址"
ExcelSheet.Cells(1, 5).Value = "类别"
ExcelSheet.Cells(1, 6).Value = "许可项目"
ExcelSheet.Cells(1, 7).Value = "区域"
ExcelSheet.Cells(1, 8).Value = "乡镇"
ExcelSheet.Cells(1, 9).Value = "发证日期"
ExcelSheet.Cells(1, 10).Value = "截止日期"
ExcelSheet.Range("A2").CopyFromRecordset rsExcelBook.SaveAs strExcelPath + "临时卫生许可证报表"
ExcelApp.Visible = True
这些代码看一下,就会了。
它就会说超出范围,我该怎么访问>3的工作表呢?