DOSYA İndirmek/Yüklemek için ÜCRETLİ ALTIN ÜYELİK Gereklidir!
Altın Üyelik Hakkında Bilgi
Aşağıdaki linkte bulunan #6 nolu mesajdaki kodu deneyiniz.
http://www.excel.web.tr/f48/command-button-ile-klasor-acma-t137920.html
Aşağıdaki kodlar sanırım işinizi görür. Ben mevcut dosya yoluna oluşturdum. Siz
Dosya_Yolu = ThisWorkbook.Path & "\" '"N:\AAA\BBB\2017\" kısmındaki ThisWorkbook.Path & "\" ' kısmı silin.
[/code]
Option Explicit
Sub ASKM__Klasör_Olustur()
Dim X As Integer, Dosya_Adı As String
Dim Dosya_Yolu As String, Dosya_Sistemi As Object
Set Dosya_Sistemi = CreateObject("Scripting.FileSystemObject")
Dosya_Yolu = ThisWorkbook.Path & "\" '"N:\AAA\BBB\2017\"
Dosya_Adı = Format(Now(), "m mmmm")
If Not Dosya_Sistemi.FolderExists(Dosya_Yolu) Then
Dosya_Sistemi.CreateFolder (Dosya_Yolu)
End If
If Not Dosya_Sistemi.FolderExists(Dosya_Adı) Then
Dosya_Sistemi.CreateFolder (Dosya_Adı)
End If
Set Dosya_Sistemi = Nothing
MsgBox "İşleminiz tamamlanmıştır.", vbInformation, "ASERIN"
End Sub
[/code]
Private Sub CommandButton1_Click()
Set ds = CreateObject("Scripting.FileSystemObject")
If ds.FolderExists("N:\AAA\BBB\2017\3_MART") = True Then
aç = Shell("Explorer.exe N:\AAA\BBB\2017\3_MART", vbNormalFocus)
Else
MsgBox "KLASÖR BULUNAMADI"
End If
End Sub
Option Explicit
Sub ASKM__Klasör_Olustur()
Dim X As Integer, Dosya_Adı As String
Dim Dosya_Yolu As String, Dosya_Sistemi As Object
Set Dosya_Sistemi = CreateObject("Scripting.FileSystemObject")
Dosya_Yolu = ThisWorkbook.Path & "\" '"N:\AAA\BBB\2017\"
Dosya_Adı = Format(Now(), "m mmmm")
If Not Dosya_Sistemi.FolderExists(Dosya_Yolu) Then
Dosya_Sistemi.CreateFolder (Dosya_Yolu)
End If
If Not Dosya_Sistemi.FolderExists(Dosya_Adı) Then
Dosya_Sistemi.CreateFolder (Dosya_Adı)
End If
Dim ac
CreateObject("Shell.Application").Open (Dosya_Yolu & Dosya_Adı)
Set Dosya_Sistemi = Nothing
MsgBox "İşleminiz tamamlanmıştır.", vbInformation
End Sub
Private Sub CommandButton1_Click()
ay = Month(Date)
ay1 = Format(Date, "m")
ay2 = Format(Date, "mmmm")
yıl = Format(Date, "yyyy")
Set ds = CreateObject("Scripting.FileSystemObject")
If ds.FolderExists([COLOR="Red"]"N:\AAA\BBB\" & [COLOR="Blue"]yıl[/COLOR] & "\" & ay1 & "_" & ay2[/COLOR]) = True Then
aç = Shell("Explorer.exe [COLOR="Red"]N:\AAA\BBB\" & [COLOR="Blue"]yıl[/COLOR] & "\" & ay1 & "_" & ay2[/COLOR], vbNormalFocus)
Else
MsgBox "KLASÖR BULUNAMADI"
End If
End Sub
Private Sub CommandButton1_Click()
ay = Month(Date)
ay1 = Format(Date, "m")
ay2 = Format(Date, "mmmm")
yıl = Format(Date, "yyyy")
Set ds = CreateObject("Scripting.FileSystemObject")
MsgBox "[COLOR="Red"]N[/COLOR]:\AAA\BBB\" & yıl & "\" & ay1 & ay2
If ds.FolderExists("[COLOR="Red"]N[/COLOR]:\AAA\BBB\" & yıl & "\" [COLOR="Red"]& ay1 & ay2)[/COLOR] = True Then
aç = Shell("Explorer.exe [COLOR="Red"]N[/COLOR]:\AAA\BBB\" & yıl & "\"[COLOR="Red"] & ay1 & ay2[/COLOR], vbNormalFocus)
Else
MsgBox "KLASÖR BULUNAMADI"
End If
End Sub
Klasör adı "3 Mart" şeklinde ise açmaz mesajınızda "3_Mart" gibi alt tire vardı
"N" diski doğru değilmi?
Aşağıdaki kodda mesajla aradığı klasör yolunu bildirecektir deneyin (alt tire yok)
Kod:Private Sub CommandButton1_Click() ay = Month(Date) ay1 = Format(Date, "m") ay2 = Format(Date, "mmmm") yıl = Format(Date, "yyyy") Set ds = CreateObject("Scripting.FileSystemObject") MsgBox "[COLOR="Red"]N[/COLOR]:\AAA\BBB\" & yıl & "\" & ay1 & ay2 If ds.FolderExists("[COLOR="Red"]N[/COLOR]:\AAA\BBB\" & yıl & "\" [COLOR="Red"]& ay1 & ay2)[/COLOR] = True Then aç = Shell("Explorer.exe [COLOR="Red"]N[/COLOR]:\AAA\BBB\" & yıl & "\"[COLOR="Red"] & ay1 & ay2[/COLOR], vbNormalFocus) Else MsgBox "KLASÖR BULUNAMADI" End If End Sub
Rica ederim, kolay gelsin.Hocam elinize saglik sorunsuz calisiyor tesrkkur ederim.
MsgBox "N:\AAA\BBB\" & yıl & "\" & ay1 & ay2
If ds.FolderExists("N:\AAA\BBB\" & yıl & "\" & ay1[COLOR="Red"] & " " & [/COLOR] ay2) = True Then
aç = Shell("Explorer.exe N:\AAA\BBB\" & yıl & "\" & ay1[COLOR="Red"] & " " & [/COLOR]ay2, vbNormalFocus)
Rica ederim, kolay gelsin.
Mesaj bölümünü silersiniz.
Belirmemişiz; "3" ile "Mart" arasında boşluk varsaKod:MsgBox "N:\AAA\BBB\" & yıl & "\" & ay1 & ay2
Kod:If ds.FolderExists("N:\AAA\BBB\" & yıl & "\" & ay1[COLOR="Red"] & " " & [/COLOR] ay2) = True Then aç = Shell("Explorer.exe N:\AAA\BBB\" & yıl & "\" & ay1[COLOR="Red"] & " " & [/COLOR]ay2, vbNormalFocus)