Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.basic.visual.misc > #1731
| From | GS <gs@somewhere.net> |
|---|---|
| Newsgroups | comp.lang.basic.visual.misc |
| Subject | Re: VB6 excel automation breaking |
| Date | 2013-03-04 01:31 -0500 |
| Organization | A noiseless patient Spider |
| Message-ID | <kh1f0l$62f$1@dont-email.me> (permalink) |
| References | <VA.0000430d.76d9a785@ukrm.net> |
Stuart's suggestion should work for your stated problem, I see another
problem you might want to change your approach on.
> oWB.Sheets("Name (2)").Name = "Name"
This line is trying to rename the copied sheet to the same name as the
sheet it was a copy of. I'd expect you'd be renaming it to the one of
the names in your rsT, and keep the sheet "Name" as the template...
wsRow(1) = 4: i = 2
Do While Not rsT.EOF
oWS(1).Cells(wsRow(1), 1) = rsT.Fields(0)
'Reset counters for next record
i = i + 1: wsRow(1) = wsRow(1) + 1
'Add a copy of sheet "Name" for each name in rsT
oWB.Sheets("Name").Copy After:=oWB.Sheets(i)
'The copy is now the active sheet
With oWB.ActiveSheet
.Name = rsT.Fields(0) '//rename immediately
.Cells(1, 2) = rsT.Fields(0): .Cells(1, 7) = sReportDate
End With
rsT.MoveNext
Loop
--
Garry
Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion
Back to comp.lang.basic.visual.misc | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
VB6 excel automation breaking R C Nesbit <spam@ukrm.net> - 2013-03-03 09:53 +0000
Re: VB6 excel automation breaking "Stuart McCall" <smccall@myunrealbox.com> - 2013-03-03 20:20 +0000
Re: VB6 excel automation breaking GS <gs@somewhere.net> - 2013-03-04 01:31 -0500
Re: VB6 excel automation breaking R C Nesbit <spam@ukrm.net> - 2013-03-04 11:49 +0000
Re: VB6 excel automation breaking GS <gs@somewhere.net> - 2013-03-04 10:34 -0500
Re: VB6 excel automation breaking GS <gs@somewhere.net> - 2013-03-06 12:56 -0500
csiph-web