Private Sub CommandButton1_Click()
Dim fs, f
Dim textTerpilih1, textTerpilih2, textTerpilih3, textTerpilih4, textTerpilih5, TextTerpilih6, textTerpilih7, textTerpilih8, textTerpilih9, textTerpilih10 As String
FiletoOpen = Application _
.GetOpenFilename("Get Text Files(*.txt),*.txt", , "Select", , False)
If VarType(FiletoOpen) = vbBoolean Then
Exit Sub
End If
Set fs = CreateObject("Scripting.FileSystemObject")
Set txtFile = fs.OpenTextFile(FiletoOpen, 1, -2)
Baris = 0
Do While Not (txtFile.atendofstream)
Baris = Baris + 1
txtline = txtFile.ReadLine
textTerpilih1 = Mid(txtline, 1, 2)
textTerpilih2 = Mid(txtline, 4, 3)
textTerpilih3 = Mid(txtline, 8, 3)
textTerpilih4 = Mid(txtline, 12, 1)
textTerpilih5 = Mid(txtline, 13, 3)
textTerpilih6 = Mid(txtline, 16, 3)
textTerpilih7 = Mid(txtline, 54, 6)
textTerpilih8 = Mid(txtline, 63, 3)
textTerpilih9 = Mid(txtline, 69, 2)
textTerpilih10 = Mid(txtline, 73, 4)
textTerpilih11 = Trim(Mid(txtline, 95, 15))
Worksheets("Sheet2").Cells(Baris, 2).Value = textTerpilih1
Worksheets("Sheet2").Cells(Baris, 3).Value = textTerpilih2
Worksheets("Sheet2").Cells(Baris, 4).Value = textTerpilih3
Worksheets("Sheet2").Cells(Baris, 5).Value = textTerpilih4
Worksheets("Sheet2").Cells(Baris, 6).Value = textTerpilih5
Worksheets("Sheet2").Cells(Baris, 7).Value = textTerpilih6
Worksheets("Sheet2").Cells(Baris, 9).Value = textTerpilih7
Worksheets("Sheet2").Cells(Baris, 11).Value = textTerpilih8
Worksheets("Sheet2").Cells(Baris, 12).Value = textTerpilih9
Worksheets("Sheet2").Cells(Baris, 14).Value = textTerpilih10
Worksheets("Sheet2").Cells(Baris, 15).Value = textTerpilih11
Loop
txtFile.Close
Date: 2011/12/20
Mohon Bantuan koding tambahan macros agar bisa pada saat mau ambil data txt nama file sesuai dgn yg kita ingin kan pada cell "Nama" ( Cell Kuning ) sehingga tidak perlu lagi memilih file pada Popup getOpenFile
jadi kita hanya perlu menuliskan nama file pada cell kuning dan tinggal klik button maka data pada file text tsb akan bisa masuk ke sheet ini.terima kasih atas bantuannya
Contoh file terlampir
| ayooo... coba cari XL-mania di linkedin.com |
| momods kebanyakan e-mail :(... unread di kantor 6 ribu lebih :( |
+-------------------------------------------------------------------+
| DILARANG : MLM, money game, OOT, iklan tanpa izin, SARA, testing, |
| pembicaraan pribadi, one line message, melecehkan, tidak sopan. |
+-------------------------------------------------------------------+
| Buat subjek yang kreatif, jangan : "tanya", "help", "mohon bantu" |
| Usahakan besar attachment < 200 kb. Gunakan winzip jika perlu. |
+-------------------------------------------------------------------+
| Ajak teman-teman Anda bergabung dengan mengirim e-mail kosong ke |
| XL-mania-subscribe@yahoogroups.com atau kirimkan mereka file dari |
| http://groups.yahoo.com/group/XL-mania/files/Promotion/ |
+-------------------------------------------------------------------+
| Berikan testimoni di : http://www.friendster.com/xlmania atau... |
| http://www.xl-mania.com/2008/06/testimoni-xl-mania.html |
+-------------------------------------------------------------------+
| Message lama ada di : |
| http://groups.yahoo.com/group/XL-mania/messages [perlu yahoo id] |
| http://www.mail-archive.com/xl-mania@yahoogroups.com |
+-------------------------------------------------------------------+
Nenhum comentário:
Postar um comentário