ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   problem with import files by excel macro (https://www.excelbanter.com/excel-programming/350980-problem-import-files-excel-macro.html)

Raven[_2_]

problem with import files by excel macro
 
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

problem with import files by excel macro
 
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

"Raven" wrote in message
oups.com...
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!!





All times are GMT +1. The time now is 07:47 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com