| | |
How to access folder in vba to impot files?
![]() |
•
•
Join Date: Jul 2008
Posts: 2
Reputation:
Solved Threads: 0
hi everyone;
can somebody help me with my project. I have different files in one folder (Budget Folder) then I will import that in a single excel file (destibook.xls). This is the code.
This code can import single file only... which is the 2008. Bellevue.xls. How can i access or get the other files inside the Budget Folder and paste it in the same file which is the destibook.xls...
in short there are 70 up files in the budget folder then I will import that in a single file only... I think I need to loop it, but how???
can someone help me pls..
thank you guys...
can somebody help me with my project. I have different files in one folder (Budget Folder) then I will import that in a single excel file (destibook.xls). This is the code.
Dim DestBook As Workbook, SrcBook As Workbook
Application.ScreenUpdating = False
Set SrcBook = Workbooks.Open("C:\Documents and Settings\cbanato\My Documents\Butget Folder\2008. Bellevue.xls")
On Error Resume Next
Set DestBook = Workbooks.Open("C:\Documents and Settings\cbanato\My Documents\folder\destibook.xls")
If Err.Number = 1004 Then
Set DestBook = Workbooks.Add
SrcBook.Worksheets(1).Range("B2:C2,E2:F2").Copy
DestBook.Worksheets(1).Range("A1").PasteSpecial
Application.CutCopyMode = False
DestBook.SaveAs ("C:\Documents and Settings\cbanato\My Documents\KPI folder\destibook.xls")
DestBook.Close
Else
SrcBook.Worksheets(1).Range("B2:C2,E2:F2").Copy
DestBook.Worksheets(1).Range("A1").PasteSpecial
Application.CutCopyMode = False
DestBook.Save
DestBook.Close
End If
On Error GoTo 0
Set DestBook = Nothing
Set SrcBook = NothingThis code can import single file only... which is the 2008. Bellevue.xls. How can i access or get the other files inside the Budget Folder and paste it in the same file which is the destibook.xls...
in short there are 70 up files in the budget folder then I will import that in a single file only... I think I need to loop it, but how???
can someone help me pls..
thank you guys...
![]() |
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: Need help in excel vba for charts
- Next Thread: count row and paste...
| Thread Tools | Search this Thread |
* 6 429 2007 access activex add age application basic beginner birth bmp calculator cd cells.find click client code college component connection connectionproblemusingvb6usingoledb copy creat ctrl+f data database datareport date delete dissertations dissertationthesis dissertationtopic edit error excel excelmacro file filename form hardware header iamthwee image inboxinvb internetfiledownload keypress label listbox listview liveperson login looping machine microsoft movingranges number objectinsert open oracle password prime program prompt range-objects readfile reading record refresh remotesqlserverdatabase report save search sendbyte sites sort sql sql2008 sqlserver subroutine tags textbox time urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web window windows





