我正在用VB6.0制作一个应用程序,在这个应用程序中我插入了一个Excel工作表,现在我不知道要怎么控制这个Excel工作表.比如我想让sheet1的A1单元格的值为12,要怎么写呀?主要是不知如何用代码表达sheet1的A1单元格.

热心网友

定义全局变量:Dim fRApp As Excel。ApplicationDim fRBook As Excel。WorkbookDim fRSheet As Excel。Worksheet实际运用: Set fRApp = CreateObject(\"excel。application\") fRApp。Visible = True Set fRBook = forestApp。Workbooks。Add Set fRSheet = forestBook。Sheets(1) fRSheet。PageSetup。CenterHorizontally = True fRSheet。PageSetup。CenterVertically = True fRSheet。PageSetup。PaperSize = xlPaperA4 fRSheet。PageSetup。Orientation = xlLandscape fRSheet。Range(\"A1:A1\")。Font。Name = \"宋体\" fRSheet。Range(\"A1:A1\")。Merge fRSheet。Range(\"A1:A1\")。HorizontalAlignment = xlCenter fRSheet。Range(\"A1:A1\")。VerticalAlignment = xlCenter fRSheet。Range(\"A1:A1\")。Value = 12如果要显示一个表格就得用到循环了。

热心网友

你应该在VB界面中添加一个网格MSFLEXGRID控件,添加这个控件后,写代码:MSFLEXGRID.TEXTARRAY(第i行*总列+第j列)=内容;