Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.basic.visual.misc > #1733

Re: VB6 excel automation breaking

From GS <gs@somewhere.net>
Newsgroups comp.lang.basic.visual.misc
Subject Re: VB6 excel automation breaking
Date 2013-03-04 10:34 -0500
Organization A noiseless patient Spider
Message-ID <kh2er3$1vc$1@dont-email.me> (permalink)
References <VA.0000430d.76d9a785@ukrm.net> <kh1f0l$62f$1@dont-email.me> <VA.00004312.7c6a83ec@ukrm.net>

Show all headers | View raw


> The reason for renaming the original template sheet to rsT.Fields(0) 
> and  the new copy to Name  was that the blank template was 
> automatically moved  along and ended up as the last worksheet.
> Renaming the copy leaves the blank template sheet just after the 
> sheet(1) summary.
> fixed by adding:
> oWB.Sheets("Name").Move After:=oWB.Sheets(sName)
>
> oWB.Sheets("Name").Delete doesn't work very well as Excel pops up a 
> dialog for confirmation.

If you want to insert copies to the right of the last sheet, change 
this line...

  oWB.Sheets("Name").Copy After:=oWB.Sheets(i)

To

  oWB.Sheets("Name").Copy After:=oWB.Sheets(oWB.Sheets.Count)

..which will preserve the startup location of "Name".


As for the Delete alert issue...

  appXL.DisplayAlerts = False '//turn notification off
  'delete the sheet
  appXL.DisplayAlerts = True '//turn notification back on

..where 'appXL' is the object variable holding a ref to your instance 
of Excel.

-- 
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 | NextPrevious in thread | Next in thread | Find similar | Unroll thread


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