Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default getting new workbook name from opened template

I need assistance on the code to pull the new name of a workbook.

Im using the following code to open a template (XLT). I want it opened with
no edit options so the user cannot save and overwrite the template on
accident. However, this causes Excel to open as a XLS with the template name
and in incremental number based upon how many times this has been called.
I.E. (form1.xls, form2.xls, form3.xls)

Here is my code:
Workbooks.open Filename:=<path\form.xlt, Editable:=False

What code can I use to get the correct name of the new workbook it just
created?

TIA,
Ron
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,582
Default getting new workbook name from opened template

You can also create a new workbook from a template using

Workbooks.Add Template:=<path\form.xlt

You can get the name of this new workbook when you create it using

sName = Workbooks.Add(Template:=<path\form.xlt).Name

or later using

sName = ActiveWorkbook.Name

Since it has not been saved yet, it has no path and no extension.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______


"Ronio" wrote in message
...
I need assistance on the code to pull the new name of a workbook.

Im using the following code to open a template (XLT). I want it opened
with
no edit options so the user cannot save and overwrite the template on
accident. However, this causes Excel to open as a XLS with the template
name
and in incremental number based upon how many times this has been called.
I.E. (form1.xls, form2.xls, form3.xls)

Here is my code:
Workbooks.open Filename:=<path\form.xlt, Editable:=False

What code can I use to get the correct name of the new workbook it just
created?

TIA,
Ron



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Control Name when New workbook opened from a template SC in Texas Excel Discussion (Misc queries) 2 November 25th 09 06:24 PM
Opening a workbook if not opened, going to it if already opened neotokyo[_3_] Excel Programming 0 September 24th 04 08:56 PM
Opening a workbook if not opened, going to it if already opened neotokyo[_2_] Excel Programming 1 September 24th 04 07:17 PM
Opening a workbook if not opened, going to it if already opened neotokyo Excel Programming 1 September 24th 04 06:33 PM
How to see if the opened workbook is opened by another user ? balexis Excel Programming 1 August 18th 04 04:11 PM


All times are GMT +1. The time now is 07:14 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"