white_flag
04-01-2010, 02:21 AM
hello :)
As usual, I need your help. I have this code:
Private Sub CommandButton1_Click()
Dim nFile As Integer
Dim sTemp As String
Dim nEqualsSignPos As Integer
nFile = FreeFile()
If OptionButton1 = True Then
Open "d:\data\meniu.dutch" For Input As #nFile
Do While Not EOF(nFile)
Input #nFile, sTemp
If Len(sTemp) > 0 Then
nEqualsSignPos = InStr(sTemp, "=")
nEqualsSignPos = nEqualsSignPos + 1
If InStr(sTemp, "name") Then
Range("$A$2") = Mid(sTemp, nEqualsSignPos)
End If
End If
Loop
Close nFile
End If
End Sub
I will like to put an "i" some how to make this like this
InStr(sTemp, "name"+i)
and
Range("$A$2"+i) = Mid(sTemp, nEqualsSignPos)
like this, I think will be put the text from the file in the column starting from A2 till A50. In the text file the lines are like this:
name1=text1
name2=text2
..
..
etc
also it is possible to do not have the full path like this "d:\data\meniu.dutch" just the "meniu.dutch" in the director were the sheet from excel is.
many thx
As usual, I need your help. I have this code:
Private Sub CommandButton1_Click()
Dim nFile As Integer
Dim sTemp As String
Dim nEqualsSignPos As Integer
nFile = FreeFile()
If OptionButton1 = True Then
Open "d:\data\meniu.dutch" For Input As #nFile
Do While Not EOF(nFile)
Input #nFile, sTemp
If Len(sTemp) > 0 Then
nEqualsSignPos = InStr(sTemp, "=")
nEqualsSignPos = nEqualsSignPos + 1
If InStr(sTemp, "name") Then
Range("$A$2") = Mid(sTemp, nEqualsSignPos)
End If
End If
Loop
Close nFile
End If
End Sub
I will like to put an "i" some how to make this like this
InStr(sTemp, "name"+i)
and
Range("$A$2"+i) = Mid(sTemp, nEqualsSignPos)
like this, I think will be put the text from the file in the column starting from A2 till A50. In the text file the lines are like this:
name1=text1
name2=text2
..
..
etc
also it is possible to do not have the full path like this "d:\data\meniu.dutch" just the "meniu.dutch" in the director were the sheet from excel is.
many thx