[dba-Tech] Excel VBA problem

Stephen stephen at bondsoftware.co.nz
Mon May 25 19:06:43 CDT 2009


The first is an 'i' (in a loop); the second is a '1' 

-----Original Message-----
From: dba-tech-bounces at databaseadvisors.com
[mailto:dba-tech-bounces at databaseadvisors.com] On Behalf Of
Max Wanadoo
Sent: Tuesday, 26 May 2009 11:01 a.m.
To: Stephen
Subject: Re: [dba-Tech] Excel VBA problem

Is that a "1" or an "i"?  could be a typo?

Max



-----Original Message-----
From: dba-tech-bounces at databaseadvisors.com
[mailto:dba-tech-bounces at databaseadvisors.com] On Behalf Of
Stephen
Sent: 25 May 2009 21:03
To: Discussion of Hardware and Software issues
Subject: Re: [dba-Tech] Excel VBA problem

Gustav and Max

Reporting back ...
I have since done a debug.print on each component of the
failing line, as follows

   Debug.Print Workbooks(WorkbookName).Sheets(i).Name   ' OK
   Debug.Print Workbooks(newFN).Sheets(1).Name          '
fails
    Workbooks(WorkbookName).Sheets(i).Copy _
                     Before:=Workbooks(newFN).Sheets(1)

I have re-tested, changing Sheets to Worksheets, but same
error, same place :-<

I got the syntax from MSKB 288402 (yeah I know, it's Excel
for Mac but danged if I can find PC equivalent on KB) ...
and from other sites which say basically the same thing (eg
http://social.msdn.microsoft.com/forums/en-US/isvvba/thread/
0a237cb5-544b-4cf6-b66c-da84a413c2e3/

Max, that technique of copying before Sheet(1) is
specifically mentioned in 288402

Stephen



-----Original Message-----
From: dba-tech-bounces at databaseadvisors.com
[mailto:dba-tech-bounces at databaseadvisors.com] On Behalf Of
Gustav Brock
Sent: Tuesday, 26 May 2009 12:46 a.m.
To: Stephen
Subject: Re: [dba-Tech] Excel VBA problem

Hi Stephen and Max

I've learned that you should use WorkSheet for Sheet when
dealing with WorkSheets.

/gustav


>>> max.wanadoo at gmail.com 25-05-2009 14:17 >>>
Is this :-

Sheets(i).Copy _
                     Before:=Workbooks(newFN).Sheets(1)   

Saying:-


Copy from sheet (i) to new work sheet and position before
.Sheets(1)?

Can you do that?  Is there anything before sheet(1) Or have
I misunderstood

Max



_______________________________________________
dba-Tech mailing list
dba-Tech at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/dba-tech
Website: http://www.databaseadvisors.com



_______________________________________________
dba-Tech mailing list
dba-Tech at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/dba-tech
Website: http://www.databaseadvisors.com

_______________________________________________
dba-Tech mailing list
dba-Tech at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/dba-tech
Website: http://www.databaseadvisors.com






More information about the dba-Tech mailing list