VB的一个问题 在线等 - VB / 基础类
listview的内容输出至excel中的一段代码
RowCnt = 2
ColCnt = 1
For i = 1 To Form6.listview1.ListItems.Count
For j = 1 To 8
xlSheet.Cells(RowCnt, ColCnt).Value = Form6.listview1.ListItems(i).SubItems(j)
ColCnt = ColCnt + 1
Next j
ColCnt = 1
RowCnt = RowCnt + 1
Next i
i =1时能跑,但只要到最外面的for循环时,也就是i的值从1变到2时,就会报无效的属性值
各位帮忙看看
顶上去
报错会不会是针对xlSheet.Cells呢
单步调试,检查这句
xlSheet.Cells(RowCnt, ColCnt).Value = Form6.listview1.ListItems(i).SubItems(j)
i,j的值是否有越界。
xlSheet.Cells(RowCnt, ColCnt).Value = Form6.listview1.ListItems(1).SubItems(8)
到此都是可以的,但再按f8就跳到错误了
xlSheet.Cells(RowCnt, ColCnt).Value 怎么会报错呢? RowCnt ColCnt 都是常量
我靠,居然是这原因,谢谢了 结贴
相关问答:
在vb中如何读取Word内容(包含表格,图片,等)
竟然不是zero。
不知道怎么实现的不要说话
这个只能读文本,
VB code:
Private Sub Command1_Click()
Dim WordApp As Object
Set WordApp = CreateObject(& ......
我想把word另存为xml之后,用vb读取这个xml的内容,请问如何实现?
dim f as integer
dim b() as byte
dim s as string
dim L as long
f=freefile()
open "abc.xml" for binary access read as #f
......
问题:
现在Access数据库中有两张表TableA和TableB
TableA中有记录如下:
字段1(Name) 字段2(Num)
A 3
A 4
B 6
... ......
挺繁琐,之前发的帖子,分值太低现在重发一个。欢迎各位大侠~~
#include "stdlib.h"
#include "math.h"
#include "stdio.h"
float objfx(float x[]);
void constraint(float x[] ......