30/09/2022, 15:05
bir butono asagidaki kodu ekleyip, Link yolunu duzenleyip denermisin, " sFileName = "\Downloads\" & "toplunbt.xlsb""
Private Sub CMDEXCEL_Click()
On Error GoTo HATA
Set myFile = Application.FileDialog(msoFileDialogSaveAs)
With myFile
.Title = "Choose File"
.AllowMultiSelect = False
.ButtonName = "&Export"
.InitialFileName = CurrentProject.Path & "\" & "toplunbt_" & Format(Now(), "dd.mm.yyyy_HH.mm") & ".xlsb"
.Title = "Export file toplunbt"
If .Show <> -1 Then
MsgBox "File not saved, you have cancelled!"
Exit Sub
End If
FileSelected = .SelectedItems(1)
End With
If InStr(FileSelected, ".xlsb") = 0 Then
FileSelected = FileSelected & ".xlsb"
Else
End If
sFileName = "\Downloads\" & "toplunbt.xlsb"
Set xlApp = CreateObject("Excel.Application")
Set xlWb = xlApp.Workbooks.Open(sFileName)
Set xlWs = xlWb.Worksheets(1)
Set rst = CurrentDb.OpenRecordset("SELECT Adi, Soyadi, sicil, Emekli_sicil_no, Tc_kimlik, Baba_adi, Anne_adi, Dogum_yeri_ili, Dogum_yeri_ilcesi FROM Personel_Bilgileri; ;", dbOpenDynaset)
xlWs.Activate
xlWs.Range("A2").CopyFromRecordset rst
Set rst = Nothing
sFileName = FileSelected
xlWs.SaveAs sFileName
HATA:
Set xlWb = Nothing
Set xlWs = Nothing
xlApp.Quit
MsgBox ("MASAUSTUNE GONDERILDI " & sFileName)
End Sub
Private Sub CMDEXCEL_Click()
On Error GoTo HATA
Set myFile = Application.FileDialog(msoFileDialogSaveAs)
With myFile
.Title = "Choose File"
.AllowMultiSelect = False
.ButtonName = "&Export"
.InitialFileName = CurrentProject.Path & "\" & "toplunbt_" & Format(Now(), "dd.mm.yyyy_HH.mm") & ".xlsb"
.Title = "Export file toplunbt"
If .Show <> -1 Then
MsgBox "File not saved, you have cancelled!"
Exit Sub
End If
FileSelected = .SelectedItems(1)
End With
If InStr(FileSelected, ".xlsb") = 0 Then
FileSelected = FileSelected & ".xlsb"
Else
End If
sFileName = "\Downloads\" & "toplunbt.xlsb"
Set xlApp = CreateObject("Excel.Application")
Set xlWb = xlApp.Workbooks.Open(sFileName)
Set xlWs = xlWb.Worksheets(1)
Set rst = CurrentDb.OpenRecordset("SELECT Adi, Soyadi, sicil, Emekli_sicil_no, Tc_kimlik, Baba_adi, Anne_adi, Dogum_yeri_ili, Dogum_yeri_ilcesi FROM Personel_Bilgileri; ;", dbOpenDynaset)
xlWs.Activate
xlWs.Range("A2").CopyFromRecordset rst
Set rst = Nothing
sFileName = FileSelected
xlWs.SaveAs sFileName
HATA:
Set xlWb = Nothing
Set xlWs = Nothing
xlApp.Quit
MsgBox ("MASAUSTUNE GONDERILDI " & sFileName)
End Sub