Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.basic.visual.misc > #1734
| From | GS <gs@somewhere.net> |
|---|---|
| Newsgroups | comp.lang.basic.visual.misc |
| Subject | Re: VB6 excel automation breaking |
| Date | 2013-03-06 12:56 -0500 |
| Organization | A noiseless patient Spider |
| Message-ID | <kh7vtk$8a2$1@dont-email.me> (permalink) |
| References | <VA.0000430d.76d9a785@ukrm.net> <kh1f0l$62f$1@dont-email.me> <VA.00004312.7c6a83ec@ukrm.net> <kh2er3$1vc$1@dont-email.me> |
<FWIW>
I did some thinking about your approach after working on one of my VB6
frontloader apps for Excel automation. (Excel is my primary dev
platform, but I use a VB6.exe frontloader for various reasons, the main
reason being so my Excel addins use their own instance of Excel)
Your comment about the Delete alert suggests you remove (or want to
remove) Sheets("Name") when you're done. Instead of deleting, you can
just hide it (no alert raised) by setting its Visible prop False.
OR
If it's a specially formatted sheet you could ship it as a separate
file and use the Sheets.Add method of the oWB object...
Dim wkbTarget As Object '//the current file to receive data
Dim wksTarget As Object '//the current name sheet to receive data
Set wkbTarget = appXL.Workbooks.Add Template:=App.Path & "\Summary.xls"
Set oWS = wkbTarget.Sheets(1)
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
Set wksTarget = wkbTarget.Sheets.Add _
Type:=App.Path & "\Namesheet.xls", _
After:=wkbTarget.Sheets(wkbTarget.Sheets.Count)
With wksTarget
.Name = rsT.Fields(0) '//rename immediately
.Cells(1, 2) = rsT.Fields(0): .Cells(1, 7) = sReportDate
End With
rsT.MoveNext
Loop
OR
If it's just a blank sheet then you can remove the line above that
specifies the Type arg for the Sheets.Add method.
--
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 | 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