Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / January 2006

Tip: Looking for answers? Try searching our database.

problem with import files by excel macro

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Raven - 20 Jan 2006 08:22 GMT
Hello,

I need to write/record a macro that takes multiple files(UNIX files)on
the local computer and then copy all their content back to a sheet of
the excel and then manipulate the data to generate a report. I
particularly need help with macros that can import multiple files. I
have come across an excel application whose button can prompt a windows
and import ONE file to do similiar thing. However, what I want to do is
more sophisticated. Do you have any idea?? do you have any resources
from the web?? Thx!!
NickHK - 20 Jan 2006 08:38 GMT
Raven,
here what I use for Excel files. You need to edit for you text files then
"Open" and process each, or import in to Excel:
<Code>
Response = Excel.Application.GetOpenFilename("HK Spec Files (*.xls), *.xls",
, "Select the Spec Sheets to cost.", , True)

On Error Resume Next
'As we have set MultiSelect=True, this will error if 1 (or more) files were
selected.
If Response <> False Then
   'Return to normal error handling
   On Error GoTo 0

   'As we have set MultiSelect=True, an array of filenames will be returned
even if only 1 file was selected, with LBound=1

   FilesSelectedCount = UBound(Response)
   'Loop through all selected files
   For FileCurrent = 1 To FilesSelectedCount

       'Open the required Costs WB
       Set WBCosts = Workbooks.Open(Response(FileCurrent), , , ,)
       ...............Process
   Loop
</Code>

> Hello,
>
[quoted text clipped - 6 lines]
> more sophisticated. Do you have any idea?? do you have any resources
> from the web?? Thx!!
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.