PC Review


Reply
Thread Tools Rate Thread

Creation of Import Files

 
 
=?Utf-8?B?S2lyayBQLg==?=
Guest
Posts: n/a
 
      5th Jun 2007
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 With Quote
 
 
 
 
=?Utf-8?B?VG9tIE9naWx2eQ==?=
Guest
Posts: n/a
 
      5th Jun 2007
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 With Quote
 
=?Utf-8?B?S2lyayBQLg==?=
Guest
Posts: n/a
 
      5th Jun 2007
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 With Quote
 
=?Utf-8?B?VG9tIE9naWx2eQ==?=
Guest
Posts: n/a
 
      5th Jun 2007
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 With Quote
 
=?Utf-8?B?S2lyayBQLg==?=
Guest
Posts: n/a
 
      5th Jun 2007
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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
import emails and contact names into outlook, data creation excel gman Microsoft Outlook Discussion 1 13th Jan 2009 12:11 AM
Problems with the creation of folders (was: Import messages from O =?Utf-8?B?QW50b25pbw==?= Windows Vista Mail 0 20th Aug 2007 08:46 PM
assign number from table to record on import and creation MN Microsoft Access 5 11th Aug 2006 10:15 PM
Outlook automatic folder creation on rule import =?Utf-8?B?bWVsX2JhZ2xleQ==?= Microsoft Outlook Discussion 1 24th Mar 2005 03:24 PM
Creation of Help Files =?Utf-8?B?U3RldmUgTXVycGh5IChLdXdhaXQgaW4gQXJteSoq Microsoft Access 3 29th Nov 2004 06:03 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:56 PM.