<a name=▲このページのトップに戻る
293101マクロでファイルがひらけれません。イッチー 2005/09/19-11:11

メーカー名:NEC 日本電気
OS名:WindowsXp HomeEdition
パソコン名:VALUESTAR PC-VL5002D
--
ファイルからデータを読み込むマクロを作成したのですが、
ファイルが読み込めません。ファイル名が悪いのか?
マクロの作成の仕方が悪いのかわからないのでどなたか解決法を
教えてください。お願いします。
Sub sample01_34()

Dim myfilename As String, gilenum As Integer, buf As String, i As Long

myfilename = Application.GetOpenFilename(filefilter:="テキストファイル,*.txt")

If myfilename = "false" Then Exit Sub

filemum = freeefile

Open myfilename For Input As filenum

Do Until EOF(filenum)

Line Input #filenum, buf

ActiveCell.Offset(i, 0) = buf

i = i + 1

Loop

Close filenum
End Sub
です。

▲このページのトップに戻る
293123Re:マクロでファイルがひらけれません。test 2005/09/19-13:28

記事番号293101へのコメント
主にスペルミスです。よく見ましょう。

>Dim myfilename As String, gilenum As Integer, buf As String, i As Long
gilenum -> finenum

>filemum = freeefile
filemum -> filenum
freeefile -> FreeFile()


hed_" BORDER="0" WIDTH="88" HEIGHT="31">
◇-?マクロでファイルがひらけれません。-イッチー(2005/09/19-11:11)No.293101
 ┗?!Re:マクロでファイルがひらけれ...-test(2005/09/19-13:28)No.293123

▲このページのトップに戻る
293101マクロでファイルがひらけれません。イッチー 2005/09/19-11:11

メーカー名:NEC 日本電気
OS名:WindowsXp HomeEdition
パソコン名:VALUESTAR PC-VL5002D
--
ファイルからデータを読み込むマクロを作成したのですが、
ファイルが読み込めません。ファイル名が悪いのか?
マクロの作成の仕方が悪いのかわからないのでどなたか解決法を
教えてください。お願いします。
Sub sample01_34()

Dim myfilename As String, gilenum As Integer, buf As String, i As Long

myfilename = Application.GetOpenFilename(filefilter:="テキストファイル,*.txt")

If myfilename = "false" Then Exit Sub

filemum = freeefile

Open myfilename For Input As filenum

Do Until EOF(filenum)

Line Input #filenum, buf

ActiveCell.Offset(i, 0) = buf

i = i + 1

Loop

Close filenum
End Sub
です。

▲このページのトップに戻る
293123Re:マクロでファイルがひらけれません。test 2005/09/19-13:28

記事番号293101へのコメント
主にスペルミスです。よく見ましょう。

>Dim myfilename As String, gilenum As Integer, buf As String, i As Long
gilenum -> finenum

>filemum = freeefile
filemum -> filenum
freeefile -> FreeFile()