Merhaba,
Excel den Access tablosuna veri aktarmak istiyorum ama problemim şu sheet olarak alabiliyorum ama 84 adet adet sheetim var ve her sheet ten sadece belirli hücereleri almak istiyorum bu mümkün olabilirmi? yoksa tüm sheet leri indirip sorgu ile mi almam gerekiyor.
Saygılar.
Excel veri aktarımı için aşağıdaki kodları kullanıyorum;
_______________________________________________________________________
Option Compare Database 'Use database order for string comparisons
Option Explicit
Dim path As String
Const LWA_COLORKEY = &H1
Const LWA_ALPHA = &H2
Const GWL_EXSTYLE = (-20)
Const WS_EX_LAYERED = &H80000
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function SetLayeredWindowAttributes Lib "user32" (ByVal hwnd As Long, ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long
Private Sub EXCEL_Click()
DoCmd.SetWarnings False
DoCmd.RunSQL "DELETE FROM TL_Vadeli "
DoCmd.SetWarnings True
getFileName
DoCmd.TransferSpreadsheet acImport, 8, "Aktarılan", Me.Dosya, False, "A2:J20000"
MsgBox "Aktarım Tamamlandı", 0, "A K T A R I M"
Form.Requery
End Sub
Sub getFileName()
DoCmd.SetWarnings False
Dim FileName As String
Dim result As Integer
With Application.FileDialog(msoFileDialogFilePicker)
.Title = "excel dosyaları"
.Filters.Add "excel", "*.xls"
.FilterIndex = 1
.AllowMultiSelect = False
.InitialFileName = CurrentProject.path
result = .Show
If (result <> 0) Then
FileName = Trim(.SelectedItems.Item(1))
Me![Dosya].Visible = True
Me![Dosya].SetFocus
Me![Dosya].Text = FileName
End If
End With
End Sub
Excel den Access tablosuna veri aktarmak istiyorum ama problemim şu sheet olarak alabiliyorum ama 84 adet adet sheetim var ve her sheet ten sadece belirli hücereleri almak istiyorum bu mümkün olabilirmi? yoksa tüm sheet leri indirip sorgu ile mi almam gerekiyor.
Saygılar.
Excel veri aktarımı için aşağıdaki kodları kullanıyorum;
_______________________________________________________________________
Option Compare Database 'Use database order for string comparisons
Option Explicit
Dim path As String
Const LWA_COLORKEY = &H1
Const LWA_ALPHA = &H2
Const GWL_EXSTYLE = (-20)
Const WS_EX_LAYERED = &H80000
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function SetLayeredWindowAttributes Lib "user32" (ByVal hwnd As Long, ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long
Private Sub EXCEL_Click()
DoCmd.SetWarnings False
DoCmd.RunSQL "DELETE FROM TL_Vadeli "
DoCmd.SetWarnings True
getFileName
DoCmd.TransferSpreadsheet acImport, 8, "Aktarılan", Me.Dosya, False, "A2:J20000"
MsgBox "Aktarım Tamamlandı", 0, "A K T A R I M"
Form.Requery
End Sub
Sub getFileName()
DoCmd.SetWarnings False
Dim FileName As String
Dim result As Integer
With Application.FileDialog(msoFileDialogFilePicker)
.Title = "excel dosyaları"
.Filters.Add "excel", "*.xls"
.FilterIndex = 1
.AllowMultiSelect = False
.InitialFileName = CurrentProject.path
result = .Show
If (result <> 0) Then
FileName = Trim(.SelectedItems.Item(1))
Me![Dosya].Visible = True
Me![Dosya].SetFocus
Me![Dosya].Text = FileName
End If
End With
End Sub