Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 66
Default Creation of Import Files

I'm trying to take data from 74 Excel files, 8 worksheets and import it into
an Access database. I'm fairly fluent in Access, and I can accomplish this,
but the import process is extremely slow (5 hours) due to the fact all the
Excel files are linked. If I use Copy/Paste Special/Values, the links are
broken and the import time drops to about an hour, which is acceptable.

I'm looking for an automated means in Excel to loop through all 74 files, 8
worksheets per file, and apply a Copy/Paste Special/Values command within
each worksheet. Help?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Creation of Import Files

Sub ProcessWorkbooks()
Dim bk as Workbook
Dim sPath as String
Dim v as Variant, i as Long
Dim sh as Worksheet
spath = "C:\MyFolder\"
v = Array("Book1.xls", ... , "Book8.xls")
for i = lbound(v) to ubound(v)
set bk = workbooks.Open( sPath & v(i))
for each sh in bk
sh.UsedRange.formula = sh.UsedRange.Value
next
bk.Close Savechanges:=False
Next
End sub

--
Regards,
Tom Ogilvy


"Kirk P." wrote:

I'm trying to take data from 74 Excel files, 8 worksheets and import it into
an Access database. I'm fairly fluent in Access, and I can accomplish this,
but the import process is extremely slow (5 hours) due to the fact all the
Excel files are linked. If I use Copy/Paste Special/Values, the links are
broken and the import time drops to about an hour, which is acceptable.

I'm looking for an automated means in Excel to loop through all 74 files, 8
worksheets per file, and apply a Copy/Paste Special/Values command within
each worksheet. Help?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 66
Default Creation of Import Files

I'm hitting a run-time error 438 Object doesn't support this property or
method at the line:

for each sh in bk

Also, the source files are linked, so it asks me if I want to update the
links first. Can this be defaulted to "No" - i.e. Don't Update?



"Tom Ogilvy" wrote:

Sub ProcessWorkbooks()
Dim bk as Workbook
Dim sPath as String
Dim v as Variant, i as Long
Dim sh as Worksheet
spath = "C:\MyFolder\"
v = Array("Book1.xls", ... , "Book8.xls")
for i = lbound(v) to ubound(v)
set bk = workbooks.Open( sPath & v(i))
for each sh in bk
sh.UsedRange.formula = sh.UsedRange.Value
next
bk.Close Savechanges:=False
Next
End sub

--
Regards,
Tom Ogilvy


"Kirk P." wrote:

I'm trying to take data from 74 Excel files, 8 worksheets and import it into
an Access database. I'm fairly fluent in Access, and I can accomplish this,
but the import process is extremely slow (5 hours) due to the fact all the
Excel files are linked. If I use Copy/Paste Special/Values, the links are
broken and the import time drops to about an hour, which is acceptable.

I'm looking for an automated means in Excel to loop through all 74 files, 8
worksheets per file, and apply a Copy/Paste Special/Values command within
each worksheet. Help?

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Creation of Import Files

Sub ProcessWorkbooks()
Dim bk as Workbook
Dim sPath as String
Dim v as Variant, i as Long
Dim sh as Worksheet
spath = "C:\MyFolder\"
v = Array("Book1.xls", ... , "Book8.xls")
for i = lbound(v) to ubound(v)
set bk = workbooks.Open( sPath & v(i), UpdateLinks:=0)
for each sh in bk.Worksheets
sh.UsedRange.formula = sh.UsedRange.Value
next
bk.Close Savechanges:=False
Next
End sub

--
Regards,
Tom Ogilvy



"Kirk P." wrote:

I'm hitting a run-time error 438 Object doesn't support this property or
method at the line:

for each sh in bk

Also, the source files are linked, so it asks me if I want to update the
links first. Can this be defaulted to "No" - i.e. Don't Update?



"Tom Ogilvy" wrote:

Sub ProcessWorkbooks()
Dim bk as Workbook
Dim sPath as String
Dim v as Variant, i as Long
Dim sh as Worksheet
spath = "C:\MyFolder\"
v = Array("Book1.xls", ... , "Book8.xls")
for i = lbound(v) to ubound(v)
set bk = workbooks.Open( sPath & v(i))
for each sh in bk
sh.UsedRange.formula = sh.UsedRange.Value
next
bk.Close Savechanges:=False
Next
End sub

--
Regards,
Tom Ogilvy


"Kirk P." wrote:

I'm trying to take data from 74 Excel files, 8 worksheets and import it into
an Access database. I'm fairly fluent in Access, and I can accomplish this,
but the import process is extremely slow (5 hours) due to the fact all the
Excel files are linked. If I use Copy/Paste Special/Values, the links are
broken and the import time drops to about an hour, which is acceptable.

I'm looking for an automated means in Excel to loop through all 74 files, 8
worksheets per file, and apply a Copy/Paste Special/Values command within
each worksheet. Help?

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 66
Default Creation of Import Files

Works great Tom. Thanks for the help!

"Tom Ogilvy" wrote:

Sub ProcessWorkbooks()
Dim bk as Workbook
Dim sPath as String
Dim v as Variant, i as Long
Dim sh as Worksheet
spath = "C:\MyFolder\"
v = Array("Book1.xls", ... , "Book8.xls")
for i = lbound(v) to ubound(v)
set bk = workbooks.Open( sPath & v(i), UpdateLinks:=0)
for each sh in bk.Worksheets
sh.UsedRange.formula = sh.UsedRange.Value
next
bk.Close Savechanges:=False
Next
End sub

--
Regards,
Tom Ogilvy



"Kirk P." wrote:

I'm hitting a run-time error 438 Object doesn't support this property or
method at the line:

for each sh in bk

Also, the source files are linked, so it asks me if I want to update the
links first. Can this be defaulted to "No" - i.e. Don't Update?



"Tom Ogilvy" wrote:

Sub ProcessWorkbooks()
Dim bk as Workbook
Dim sPath as String
Dim v as Variant, i as Long
Dim sh as Worksheet
spath = "C:\MyFolder\"
v = Array("Book1.xls", ... , "Book8.xls")
for i = lbound(v) to ubound(v)
set bk = workbooks.Open( sPath & v(i))
for each sh in bk
sh.UsedRange.formula = sh.UsedRange.Value
next
bk.Close Savechanges:=False
Next
End sub

--
Regards,
Tom Ogilvy


"Kirk P." wrote:

I'm trying to take data from 74 Excel files, 8 worksheets and import it into
an Access database. I'm fairly fluent in Access, and I can accomplish this,
but the import process is extremely slow (5 hours) due to the fact all the
Excel files are linked. If I use Copy/Paste Special/Values, the links are
broken and the import time drops to about an hour, which is acceptable.

I'm looking for an automated means in Excel to loop through all 74 files, 8
worksheets per file, and apply a Copy/Paste Special/Values command within
each worksheet. Help?



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
OLAP Creation in Excel / MS Query -- .cub files piperbrian Excel Discussion (Misc queries) 0 September 1st 08 09:38 PM
Would Like to Automate Batch File Creation and Text FIle Import socrtwo Excel Discussion (Misc queries) 2 August 18th 06 03:54 PM
Disable creation of Enhanced Meta Files? Nick Excel Programming 1 May 24th 06 06:51 PM
How can I selectively stop creation of Excel *.xlk files? Ida Noe Alaska Setting up and Configuration of Excel 1 February 23rd 06 09:37 PM
Import multiple files macro can't find files Steven Rosenberg Excel Programming 1 August 7th 03 01:47 AM


All times are GMT +1. The time now is 09:20 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"