excelden txt aktarırken dosya adı verme

Katılım
25 Aralık 2011
Mesajlar
24
Excel Vers. ve Dili
2007 tr
merhaba arkadaslar asagıdakı kod ile sayfa2 deki verileri txt dosyasına test.txt olarak kayıt ediyor ben bu txt dosyasına sayfa1 deki p1 hucresindeki degeri vermesini ve sonunda test.txt degilde yenı olusturdugu txt dosyasını actırmak istiyorum ne gibi bir degisiklik yapmam gerek kodlar da
Kod:
Sub Makro4()
Dim deg As String, i As Long, st As Long, j As Byte
st = Cells(Rows.Count, "A").End(xlUp).Row
Open (ThisWorkbook.Path & "\test.txt") For Output As #1
For i = 1 To st
    For j = 1 To 5
        deg = deg & " " & Cells(i, j)
    Next j
    deg = Right(deg, Len(deg) - 1)
    Print #1, deg
    deg = ""
Next i
Close #1
MsgBox "Not olusturuldu." & vbLf & ""
Shell "notepad.exe " & ActiveWorkbook.Path & "/test.txt"
End Sub
 

halit3

Uzman
Uzman
Katılım
18 Ocak 2008
Mesajlar
12,788
Excel Vers. ve Dili
2003 excell türkçe
ve
2007 excell türkçe
KOD

Rich (BB code):
Sub Makro4()
Dim deg As String, i As Long, st As Long, j As Byte


st = Cells(Rows.Count, "A").End(xlUp).Row

dosya = Worksheets("Sayfa1").Range("P1").Value
Open (ThisWorkbook.Path & "\" & dosya) For Output As #1
For i = 1 To st
    For j = 1 To 5
        deg = deg & " " & Cells(i, j)
    Next j
    deg = Right(deg, Len(deg) - 1)
    Print #1, deg
    deg = ""
Next i
Close #1
MsgBox "Not olusturuldu." & vbLf & ""
Shell "notepad.exe " & ActiveWorkbook.Path & "/" & dosya
End Sub
 

halit3

Uzman
Uzman
Katılım
18 Ocak 2008
Mesajlar
12,788
Excel Vers. ve Dili
2003 excell türkçe
ve
2007 excell türkçe
kodun uzantısını yazmayı unutmuşum
Rich (BB code):
Sub Makro4()
Dim deg As String, i As Long, st As Long, j As Byte


st = Cells(Rows.Count, "A").End(xlUp).Row

dosya = Worksheets("Sayfa1").Range("P1").Value & ".txt"
Open (ThisWorkbook.Path & "\" & dosya) For Output As #1
For i = 1 To st
    For j = 1 To 5
        deg = deg & " " & Cells(i, j)
    Next j
    deg = Right(deg, Len(deg) - 1)
    Print #1, deg
    deg = ""
Next i
Close #1
MsgBox "Not olusturuldu." & vbLf & ""
Shell "notepad.exe " & ActiveWorkbook.Path & "/" & dosya
End Sub
 

halit3

Uzman
Uzman
Katılım
18 Ocak 2008
Mesajlar
12,788
Excel Vers. ve Dili
2003 excell türkçe
ve
2007 excell türkçe
Teşekkürler iyi çalışmalar
 
Üst