30/06/2012, 14:20
MERHABA BİR Access PROJEM VAR. Excel IMPORT ETME BUTONU OLACAK VE KULLANICI BUTONA TIKLAYIP "İSTEDİĞİ Excel DOSYASINI" IMPORT EDECEK. BUNU FORM OLUŞTURARAK Vba İLE YAPACAĞIM GALİBA. YARDIMLARINIZ İÇİN ŞİMDİDEN TEŞEKKÜR EDİYORUM.
DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, "Tablo_Adi", "Excel_Dosyasi_Yolu_ve_Adi", True
Private Secilen As String
Private Declare Function GetOpenFileName Lib "comdlg32.dll" Alias "GetOpenFileNameA" (pOpenfilename As OpenFilename) As Long
Private Type OpenFilename
lStructSize As Long
hwndOwner As Long
hInstance As Long
lpstrFilter As String
lpstrCustomFilter As String
nMaxCustFilter As Long
iFilterIndex As Long
lpstrFile As String
nMaxFile As Long
lpstrFileTitle As String
nMaxFileTitle As Long
lpstrInitialDir As String
lpstrTitle As String
Flags As Long
nFileOffset As Integer
nFileExtension As Integer
lpstrDefExt As String
lCustData As Long
lpfnHook As Long
lpTemplateName As String
End Type
Private Function DosyaAcFonksiyonu() As String
Dim Secilenin As OpenFilename
Secilenin.lStructSize = Len(Secilenin)
Secilenin.hwndOwner = hwnd
Secilenin.lpstrFilter = "Excel Dosyaları (*.xls*)" & Chr$(0) & "*.xls" & Chr$(0) & Chr(0) & Chr(0)
Secilenin.lpstrFile = String(256, 0)
Secilenin.nMaxFile = 255
Secilenin.lpstrTitle = "Dosya Aç"
Secilenin.Flags = &H800000 + &H1000 + &H8 + &H4
GetOpenFileName Secilenin
If Mid(Secilenin.lpstrFile, 1, 1) <> Chr(0) Then DosyaAcFonksiyonu = Secilenin.lpstrFile
Secilen = Secilenin.lpstrFile
End Function
Private Sub Komut0_Click()
Dim Dosya As String
Dosya = DosyaAcFonksiyonu
If Dosya <> "" Then DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, "Tablo_Adi", Dosya, True
End Sub
Private Secilen As String
Private Declare Function GetOpenFileName Lib "comdlg32.dll" Alias "GetOpenFileNameA" (pOpenfilename As OpenFilename) As Long
Private Type OpenFilename
lStructSize As Long
hwndOwner As Long
hInstance As Long
lpstrFilter As String
lpstrCustomFilter As String
nMaxCustFilter As Long
iFilterIndex As Long
lpstrFile As String
nMaxFile As Long
lpstrFileTitle As String
nMaxFileTitle As Long
lpstrInitialDir As String
lpstrTitle As String
Flags As Long
nFileOffset As Integer
nFileExtension As Integer
lpstrDefExt As String
lCustData As Long
lpfnHook As Long
lpTemplateName As String
End Type
Private Function DosyaAcFonksiyonu() As String
Dim Secilenin As OpenFilename
Secilenin.lStructSize = Len(Secilenin)
Secilenin.hwndOwner = hwnd
Secilenin.lpstrFilter = "Excel Dosyaları (*.xls*)" & Chr$(0) & "*.xls" & Chr$(0) & Chr(0) & Chr(0)
Secilenin.lpstrFile = String(256, 0)
Secilenin.nMaxFile = 255
Secilenin.lpstrTitle = "Dosya Aç"
Secilenin.Flags = &H800000 + &H1000 + &H8 + &H4
GetOpenFileName Secilenin
If Mid(Secilenin.lpstrFile, 1, 1) <> Chr(0) Then DosyaAcFonksiyonu = Secilenin.lpstrFile
Secilen = Secilenin.lpstrFile
End Function
Private Sub Komut0_Click()
Dim Dosya As String
Dosya = DosyaAcFonksiyonu
If Dosya <> "" Then DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, "Tablo_Adi", Dosya, True
End Sub