永发信息网

如何把Msflexgrid1里面的表格放大

答案:2  悬赏:20  手机版
解决时间 2021-04-03 21:24
  • 提问者网友:我是女神我骄傲
  • 2021-04-03 12:16
如何把Msflexgrid1里面的表格放大
最佳答案
  • 五星知识达人网友:鱼芗
  • 2021-04-03 12:37
Dim i As Integer
Dim j As Integer
With Me.flexgrid1
.Visible = False '加快运行速度
For i = 0 To .Rows - 1
For j = 0 To .Cols - 1
.Row = i
.Col = j
If .CellForeColor = vbRed Then '假设红色是vbred,具体是那个红色你要知道,否则这个条件没法搞,要知道红色的具体长整形值。
'这里你就知道行数和列数,另外.Text 是cell的值
End If
Next
Next
.Visible = True
End With
全部回答
  • 1楼网友:你哪知我潦倒为你
  • 2021-04-03 12:48
贴一段我写的vb源码,希望对你有用 dim i, j as integer dim objexlapp as new excel.application dim objexlbook as new excel.workbook dim objexlsheet as new excel.worksheet dim wsheet as string wsheet = labn.caption if msfg1.rows > 1 then '另存到xls文件 ' 设置“取消”为 true commondialog1.cancelerror = true on error goto errhandler commondialog1.filter = "excel文件(*.xls)|*.xls|所有文件|*.*" commondialog1.filename = txtproduction.text & format(now, "yyyymmdd") & ".xls" commondialog1.showsave objexlapp.visible = false objexlapp.displayalerts = false objexlapp.screenupdating = false '创建新的工作薄 set objexlbook = objexlapp.workbooks.add '设置要使用的工作表 set objexlsheet = objexlbook.sheets(1) objexlsheet.cells(1, 1) = "生产统计" objexlsheet.cells(2, 1) = labt.caption 'objexlsheet.cells(3, 1) = "生产编排顺序" 'objexlsheet.cells(3, 2) = "要求出版时间" ' objexlsheet.cells(3, 7) = "备注" for i = 0 to msfg1.rows - 1 objexlsheet.cells(i + 3, 1) = msfg1.textmatrix(i, 1) objexlsheet.cells(i + 3, 2) = msfg1.textmatrix(i, 2) objexlsheet.cells(i + 3, 3) = msfg1.textmatrix(i, 3) 'objexlsheet.cells(i + 3, 4) = msfg1.textmatrix(i, 15) objexlsheet.cells(i + 3, 5) = msfg1.textmatrix(i, 4) objexlsheet.cells(i + 3, 6) = msfg1.textmatrix(i, 5) objexlsheet.cells(i + 3, 7) = msfg1.textmatrix(i, 6) objexlsheet.cells(i + 3, 8) = msfg1.textmatrix(i, 7) objexlsheet.cells(i + 3, 9) = msfg1.textmatrix(i, 8) objexlsheet.cells(i + 3, 10) = msfg1.textmatrix(i, 9) objexlsheet.cells(i + 3, 11) = msfg1.textmatrix(i, 10) objexlsheet.cells(i + 3, 12) = msfg1.textmatrix(i, 11) objexlsheet.cells(i + 3, 13) = msfg1.textmatrix(i, 12) objexlsheet.cells(i + 3, 14) = msfg1.textmatrix(i, 13) objexlsheet.cells(i + 3, 15) = msfg1.textmatrix(i, 14) next i sfilename = commondialog1.filename objexlsheet.saveas sfilename objexlapp.visible = true objexlapp.screenupdating = true objexlapp.displayalerts = true objexlapp.application.quit set objexlsheet = nothing set objexlbook = nothing set objexlapp = nothing 'objexlbook.close msgbox "文件已生成,在:" & sfilename else msgbox "没有可导出的数据,请先进行查询!" end if errhandler: exit sub
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯