[VBA ] 请教VBA dictionary 与 读取大资料的问题

楼主: gecer (gecer)   2015-05-27 22:47:22
1 小弟要读取一个大约600MB的 txt file 但是会出现out of memory 如何改善?
小弟电脑配备如下 win7 64 bit 16G ram
code 如下
Private Function ReadFile1(sFile As String) As Byte()
Dim nFile As Integer
nFile = FreeFile
Open sFile For Input Access Read As #nFile
If LOF(nFile) > 0 Then
ReadFile1 = InputB(LOF(nFile), nFile)
End If
Close #nFile
End Function
2 VB的dictionary 如何 加入新的type到item
例如 在dictionary的item加入dictionary 语法如下
ditionary.add "string1",new dictionary
ditionary.add "string2",new dictionary
string1 和 string2的item是不同的object
但是type如何加到dictionary
小弟试过code如下
Type A
B as integer
C as string
End type
dim A1 as A
A1.B=1
dictionary.add "string1",A1
A1.B=2
dictionary.add "string2",A1
但是此时 string1 & string2 的 A1.B都是相同的
如何令string1的A1.B=1 & string2的A1.B=2
作者: MOONRAKER (㊣牛鹤鳗毛人)   2015-05-28 09:46:00
A1都同一个物件当然马相同

Links booklink

Contact Us: admin [ a t ] ucptt.com