[AccessD] Deleting Worksheet

Rocky Smolin rockysmolin at bchacc.com
Thu Jan 30 22:02:23 CST 2014


The sheet that's being copied  from the external workbook is named the value
of the item data in the list box.  The list box is a list of job numbers and
it's a multiselect so the user can select as many jobs as they want to be in
the created workbook.

When the workbook is created it has three worksheets in it, just like a new
worksheet in Excel.

R



-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Charlotte Foust
Sent: Thursday, January 30, 2014 6:47 PM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Deleting Worksheet

So what is the original name of the sheet you're adding?  What is its name
in its parent template? And is the value of your Me.lstJobs.ItemData(intI)
expression a string that you can evaluate and test for?    I have workbooks
with no "Sheet1" in them, so it isn't requiring that name that's the
problem.  When you copy a worksheet it usually retains the name of the sheet
that's being copied (unless it would be a duplicate, of course).
 Maybe you need to count the number of worksheets in the workbook to be sure
you're tackling the right problem.

Charlotte



On Thu, Jan 30, 2014 at 6:12 PM, Rocky Smolin <rockysmolin at bchacc.com>wrote:

> Darryl:
>
> I'm not adding the new sheets - I'm copying from a template in another
> workbook:
>
>                 objXLWSAlcoa.Copy After:=objXLBook.Sheets(intXLSheetCount)
>                 objXLApp.ActiveSheet.Name = Me.lstJobs.ItemData(intI)
>                 objXLApp.ActiveWorkbook.Save
>                 Set objXLWS = objXLApp.ActiveSheet
>
> And that's working well.  The delete routine at the end cycles through 
> all the sheets and deletes any that start with "Sheet".
>
> I had three brute force deletes call out Sheet1, Sheet2, Sheet3.  It 
> deleted
> 2 and 3 and left 1.  So I tried cycling through the sheets looking for 
> left("Sheet",5). No go.  I've tried a bunch of different things.  
> Nothing seems to work.
>
> I'm leaving town tomorrow so I may take this up again when I get back 
> on Monday if I can't find a solution while I'm on the road.
>
> Thanks
>
> Rocky
>
>
>
--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com



More information about the AccessD mailing list