获取模块里的值求教,谢谢!!!!窗体:
'我想在窗体里实现把aa.txt里的一部分数据写入到nn.txt里(在写入同时,提取里面的一个字符串),写完后,在把nn.txt该名为YHMZH,请较该如何做!!!
我只知道用以下语句可以实现写数据,但无法得到YHMZH值(求教如何同时得到模块里YHMZH值)
dim lngRet as Integer
lngRet = Dqkang(App.Path & "\aa.txt", App.Path & "\nn.txt")模块: 把
Public Function Dqkang(ByVal file As String, ByVal nextfile As String) As Long
Dim s, YHMZH As String
dim m_mmm_mm as Integer
Open file For Input As #1
Open nextfile For Output As #2
Line Input #1, s
Line Input #1, s
Do While Not EOF(1)
Line Input #1, s
If InStr(s, "me=") <> 0 Then
If InStr(s, "me=") <> 0 And InStr(s, "g2312") <> 0 Then
m_mmm_mm = InStr(s, "=g2312")
YHMZH = Mid(Trim(s), m_mmm_mm + 8, Len(s) - m_mmm_mm)
End If
If InStr(s, "me=") <> 0 And InStr(s, "g2312") <> 0 Then
m_mmm_mm = InStr(Trim(s), "=g2312")
YHMZH = Mid(Trim(s), m_mmm_mm + 11, Len(Trim(s)) - m_mmm_mm - 11)
End If
If InStr(s, "me=") <> 0 And InStr(s, "g2312") = 0 And InStr(s, "me=") <> 0 And InStr(s, "g2312") = 0 Then
YHMZH = Mid(s, 12, Len(s) - 12)
End If
End If
Print #2, s ' 将文件1中的数据输入文件2中
Loop
Close #2
Close #1
End Function
'我想在窗体里实现把aa.txt里的一部分数据写入到nn.txt里(在写入同时,提取里面的一个字符串),写完后,在把nn.txt该名为YHMZH,请较该如何做!!!
我只知道用以下语句可以实现写数据,但无法得到YHMZH值(求教如何同时得到模块里YHMZH值)
dim lngRet as Integer
lngRet = Dqkang(App.Path & "\aa.txt", App.Path & "\nn.txt")模块: 把
Public Function Dqkang(ByVal file As String, ByVal nextfile As String) As Long
Dim s, YHMZH As String
dim m_mmm_mm as Integer
Open file For Input As #1
Open nextfile For Output As #2
Line Input #1, s
Line Input #1, s
Do While Not EOF(1)
Line Input #1, s
If InStr(s, "me=") <> 0 Then
If InStr(s, "me=") <> 0 And InStr(s, "g2312") <> 0 Then
m_mmm_mm = InStr(s, "=g2312")
YHMZH = Mid(Trim(s), m_mmm_mm + 8, Len(s) - m_mmm_mm)
End If
If InStr(s, "me=") <> 0 And InStr(s, "g2312") <> 0 Then
m_mmm_mm = InStr(Trim(s), "=g2312")
YHMZH = Mid(Trim(s), m_mmm_mm + 11, Len(Trim(s)) - m_mmm_mm - 11)
End If
If InStr(s, "me=") <> 0 And InStr(s, "g2312") = 0 And InStr(s, "me=") <> 0 And InStr(s, "g2312") = 0 Then
YHMZH = Mid(s, 12, Len(s) - 12)
End If
End If
Print #2, s ' 将文件1中的数据输入文件2中
Loop
Close #2
Close #1
End Function
............
YHMZH = Mid(s, 12, Len(s) - 12)
dqkang=yhmzh '这句
End If
End If
Print #2, s ...........
end function
form里
private sub command1_click()
dim aa string
aa=dqkang
msgbox aa
end sub
这种方法不行,求教高手!!!!谢谢!!!!!