ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Workbook naming (https://www.excelbanter.com/excel-programming/308785-re-workbook-naming.html)

Jenny

Workbook naming
 
Here is what I need to do. I have any number or workbooks
open and the user can run a macro that merges all the open
workbooks into a single workbook (with a tab for each of
the open workbooks). I.e. if there were 3 open workbooks,
the merged workbook would have 3 tabs.

When I make a new workbook to hold the data from the other
open workbooks, a default name is set for the new workbook
(usually Book2.xls) I just want to change this name
without saving the workbook because the workbook needs to
be deleted shortly after it is created (and it can't be
deleted if the workbook is still open) Sadly, I could
work with this but I need to do some other tasks with the
workbook that require it to not be read only <sigh

I hope this makes sense...

~Jenny

Ron de Bruin

Workbook naming
 
If the workbook is not saved you don't have to delete it.
You can simple close it and tell Excel not to save

ActiveWorkbook.Close False

I don't see your code but if your code add a new workbook to
merges all the open workbooks in like this

Dim DestSh As Worksheet
Set DestSh = Worksheets.Add

'.... code

DestSh.Close False


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Jenny" wrote in message ...
Here is what I need to do. I have any number or workbooks
open and the user can run a macro that merges all the open
workbooks into a single workbook (with a tab for each of
the open workbooks). I.e. if there were 3 open workbooks,
the merged workbook would have 3 tabs.

When I make a new workbook to hold the data from the other
open workbooks, a default name is set for the new workbook
(usually Book2.xls) I just want to change this name
without saving the workbook because the workbook needs to
be deleted shortly after it is created (and it can't be
deleted if the workbook is still open) Sadly, I could
work with this but I need to do some other tasks with the
workbook that require it to not be read only <sigh

I hope this makes sense...

~Jenny




Ron de Bruin

Workbook naming
 
Oops

I use worksheet

I mean (I need Coffee<g)

Dim DestSh As Workbook
Set DestSh = Workbooks.Add

'.... code

DestSh.Close False


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Ron de Bruin" wrote in message ...
If the workbook is not saved you don't have to delete it.
You can simple close it and tell Excel not to save

ActiveWorkbook.Close False

I don't see your code but if your code add a new workbook to
merges all the open workbooks in like this

Dim DestSh As Worksheet
Set DestSh = Worksheets.Add

'.... code

DestSh.Close False


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Jenny" wrote in message ...
Here is what I need to do. I have any number or workbooks
open and the user can run a macro that merges all the open
workbooks into a single workbook (with a tab for each of
the open workbooks). I.e. if there were 3 open workbooks,
the merged workbook would have 3 tabs.

When I make a new workbook to hold the data from the other
open workbooks, a default name is set for the new workbook
(usually Book2.xls) I just want to change this name
without saving the workbook because the workbook needs to
be deleted shortly after it is created (and it can't be
deleted if the workbook is still open) Sadly, I could
work with this but I need to do some other tasks with the
workbook that require it to not be read only <sigh

I hope this makes sense...

~Jenny







All times are GMT +1. The time now is 07:20 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com