-
please help me
I have a code in VBA that works
this is tahe code:
Private Sub Command0_Click()
Dim p As String
Dim f As String
Dim db As Database
Dim tb As TableDef
p = CurrentProject.Path & "\"
'p = "C:\email\"
f = Dir(p & "*.xls")
nume = 1
Do Until f = ""
Set db = OpenDatabase("", 0, 0, "Excel Private Sub Command0_Click()
Dim p As String
Dim f As String
Dim db As Database
Dim tb As TableDef
p = CurrentProject.Path & "\"
'p = "C:\email\"
f = Dir(p & "*.xls")
nume = 1
Do Until f = ""
Set db = OpenDatabase("", 0, 0, "Excel 8.0;HDR=YES;IMEX=2;DATABASE=" & p & f)
For Each tb In db.TableDefs '<<< fiecare worksheet sau range
If Not tb.Name Like "*_" Then 'sare peste worksheets...tmp
'imported table name schema: xlsName_sheetName
DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel8, _
Replace(nume, ".xls", "", , , 1), _
p & f, _
False, _
tb.Name '<<< our worksheet or named range
end sub
8.0;HDR=YES;IMEX=2;DATABASE=" & p & f)
For Each tb In db.TableDefs '<<< fiecare worksheet sau range
If Not tb.Name Like "*_" Then 'sare peste worksheets...tmp
'imported table name schema: xlsName_sheetName
DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel8, _
Replace(nume, ".xls", "", , , 1), _
p & f, _
False, _
tb.Name '<<< our worksheet or named range
end sub
The problem apears when i try to change p = CurrentProject.Path & "\"
to p = "C:\email\"
The problem apears at this line in my code
DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel8, _
Replace(nume, ".xls", "", , , 1), _
p & f, _
False, _
tb.Name '<<< our worksheet or named range
what I'm doing rong?
thank you
-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules