VBA ile 3 adet birbirine bagli userform olusturdum.
1. Userformda sadece directoryden kullanici incelenecek excel dosyasini sececek. Ardindan 2.Userforma gecince de o excel dosyasi üstünde farkli macro secenekleri uygulanacak. En sonunda da uygulanan makrolarin sonuclari yeni excel dosyasinda acilacak.
Asagidaki kodu yazdim ve bu sadece dosyayi secip direkt aciyor. ben arka planda secili dosyayi tutmasini istiyorum. Bir türlü beceremedim bulamadim.
Yardimlarinizi bekliyorum.
Private Sub CommandButton1_Click()
Dim Filter As String, Title As String, msg As String
Dim i As Integer, FilterIndex As Integer
Dim Filename As Variant
' File filters
Filter = "Excel Files (*.xls),*.xls," & _
"Text Files (*.txt),*.txt," & _
"All Files (*.*),*.*"
' Default filter to *.*
FilterIndex = 3
' Set Dialog Caption
Title = "Select File(s) to Open"
' Select Start Drive & Path
ChDrive ("C")
ChDir ("C:\Belgelerim/Excel_dosyalari")
With Application
' Set File Name Array to selected Files (allow multiple)
Filename = .GetOpenFilename(Filter, FilterIndex, Title, , True)
' Reset Start Drive/Path
End With
' Exit on Cancel
If Not IsArray(Filename) Then
Exit Sub
End If
' Open Files
For i = LBound(Filename) To UBound(Filename)
Workbooks.Open Filename(i)
Next i
End Sub
1. Userformda sadece directoryden kullanici incelenecek excel dosyasini sececek. Ardindan 2.Userforma gecince de o excel dosyasi üstünde farkli macro secenekleri uygulanacak. En sonunda da uygulanan makrolarin sonuclari yeni excel dosyasinda acilacak.
Asagidaki kodu yazdim ve bu sadece dosyayi secip direkt aciyor. ben arka planda secili dosyayi tutmasini istiyorum. Bir türlü beceremedim bulamadim.
Yardimlarinizi bekliyorum.
Private Sub CommandButton1_Click()
Dim Filter As String, Title As String, msg As String
Dim i As Integer, FilterIndex As Integer
Dim Filename As Variant
' File filters
Filter = "Excel Files (*.xls),*.xls," & _
"Text Files (*.txt),*.txt," & _
"All Files (*.*),*.*"
' Default filter to *.*
FilterIndex = 3
' Set Dialog Caption
Title = "Select File(s) to Open"
' Select Start Drive & Path
ChDrive ("C")
ChDir ("C:\Belgelerim/Excel_dosyalari")
With Application
' Set File Name Array to selected Files (allow multiple)
Filename = .GetOpenFilename(Filter, FilterIndex, Title, , True)
' Reset Start Drive/Path
End With
' Exit on Cancel
If Not IsArray(Filename) Then
Exit Sub
End If
' Open Files
For i = LBound(Filename) To UBound(Filename)
Workbooks.Open Filename(i)
Next i
End Sub
