• DİKKAT

    DOSYA İndirmek/Yüklemek için ÜCRETLİ ALTIN ÜYELİK Gereklidir!
    Altın Üyelik Hakkında Bilgi

yeni oluştuluran txt'yi listboxta göster, dosya yolunu tazele

  • Konbuyu başlatan Konbuyu başlatan chngrcn
  • Başlangıç tarihi Başlangıç tarihi
Katılım
5 Mart 2010
Mesajlar
295
Excel Vers. ve Dili
Microsoft Office 2010
Kod:
Private Sub CommandButton6_Click() 'YENİ TXT OLUŞTUR BUTONU
TextBox5.Value = ""

adres = ThisWorkbook.Path & "\"
dosyaadı = InputBox("Lütfen dosya adı giriniz..")
 Open adres & dosyaadı & ".TXT" For Output As #1
    Print #1, TextBox5.Value
 Close

End Sub

ekteki çalışmamda yeni txt oluştur butonuna tıkladığımda yukarıdaki kod devreye giriyor.. ve inputbox içine girilen isimde txt metin belgesi açıyor, textbox5 içindeki veriyi oluşturulan metin belgesi içine kaydedip kapatıyor..

sorunum şu;

1-inputbox içine veri girilmediği zaman txt metin belgesi oluşturmasın.. uyarı versin

2- diyelim ki bir txt dosyası oluşturduk. oluşturduğumuz yeni txt belgesi listbox1'de listelensin..

yardımlarınızı rica ediyorum.
 

Ekli dosyalar

. . .

Kod:
Private Sub CommandButton6_Click() 'YENİ TXT OLUŞTUR BUTONU
    TextBox5.Value = ""
    
    adres = ThisWorkbook.Path & "\"
    dosyaadı = InputBox("Lütfen dosya adı giriniz..")
    If dosyaadı = "" Then
        MsgBox "Dosya Adı Girmediniz!..", vbCritical
        Exit Sub
    End If
    
    Open adres & dosyaadı & ".TXT" For Output As #1
    Print #1, TextBox5.Value
    Close
    
    s1 = ListBox1.ListCount
    s2=sheets("VERİ").cells(rows.count,"A").end(3).row+1
    ListBox1.AddItem
    ListBox1.List(s1, 0) = adres & dosyaadı & ".TXT"
    ListBox1.List(s1, 1) = dosyaadı & ".TXT"
    sheets("VERİ").cells(s2,"A")=adres & dosyaadı & ".TXT"
    sheets("VERİ").cells(s2,"B")=dosyaadı & ".TXT"

End Sub

. . .
 
Geri
Üst