ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Excel startup option (https://www.excelbanter.com/excel-discussion-misc-queries/37003-excel-startup-option.html)

GeraldM

Excel startup option
 
if i double-click an excel template e.g. test.xlt then the spreadsheet opens
as test1.xls. if i right-click-open the same template then the spreadsheet
opens as test.xlt (then same happens if i use file-open). i am trying to open
a template from another program using the command line "run test.xlt" but
this opens the spreadsheet as test.xlt and i need it to open as test1.xls (ie
like double-clicking). does anyone know how to do this - i assumed it would
have been a startup switch option but cannot find one to do this - what does
double-clicking do that right-click-open does not do?

Ronald Dodge

You could try something like the following:

Have a particular field within the template file as a number field for what
number that particular file is, and starting with the number of 0. (Note:
Your first document will actually have a 1 for it's number, if it's done via
the code as suggested below)

Setup a code separately as you have indicated by your statement in a
separate workbook. Within that code, have it do the following:


Open the file

Up the number by 1 within that file.

Save that file, so as the template is saved with an increased number in the
numbering field (the Save method of the workbook)

Save the file as a new file with that new number. I.e.
Workbooks("Test.xls").SaveAs "Test" & Workbooks("Test.xlt").Range("B2").Text
& ".xlt", xlTemplate


The main concern that would be here would be the potential you could still
end up with 2 people opening the same file and trying to save as the same
name, but the odds aren't as great given 2 different things are serving as
check points. One, as long as the workbook isn't setup as a shared
workbook, only one person can have it open in "Read-Write" mode, and 2, if
the SaveAs method does find another file with the same file name within that
same folder, it will come back as "Do you want to replace the file..." or
something like that.

Depending on how large your file is, what calculations are involved
(provided it's in automatic calculation mode), hardware specs, connections,
how many users will be using it, how often the file will be accessed, and
other factors, this may or may not be suitable.

--
Ronald R. Dodge, Jr.
Production Statistician
Master MOUS 2000

"GeraldM" wrote in message
...
if i double-click an excel template e.g. test.xlt then the spreadsheet

opens
as test1.xls. if i right-click-open the same template then the spreadsheet
opens as test.xlt (then same happens if i use file-open). i am trying to

open
a template from another program using the command line "run test.xlt" but
this opens the spreadsheet as test.xlt and i need it to open as test1.xls

(ie
like double-clicking). does anyone know how to do this - i assumed it

would
have been a startup switch option but cannot find one to do this - what

does
double-clicking do that right-click-open does not do?




Dave Peterson

I bet when you double click on test.xlt, it actually creates a new workbook
named test1 (w/o the .xls extension).

If you right click on that test.xlt, you'll notice that there's a New option
(bolded) and Open (not bolded).

The bold option is the default, which means that the default action is to create
a new workbook based on this template. When you choose open, windows/excel
figures you know what you want and you want to edit the template.

I'm not sure what your other program is, but can you start excel and then create
a new workbook based on that template.

Maybe you can run a .VBS file (like an old time .BAT file) instead.

Copy this into NotePad and save this as something.VBS (change something to what
you want)

Dim XLApp
Dim XLWkb
Set XLApp = CreateObject("Excel.Application")
xlapp.visible = true
xlapp.workbooks.add "c:\myfolder1\myfolder2\test.xlt"

===
It works ok when I just double click on that .vbs file.

GeraldM wrote:

if i double-click an excel template e.g. test.xlt then the spreadsheet opens
as test1.xls. if i right-click-open the same template then the spreadsheet
opens as test.xlt (then same happens if i use file-open). i am trying to open
a template from another program using the command line "run test.xlt" but
this opens the spreadsheet as test.xlt and i need it to open as test1.xls (ie
like double-clicking). does anyone know how to do this - i assumed it would
have been a startup switch option but cannot find one to do this - what does
double-clicking do that right-click-open does not do?


--

Dave Peterson


All times are GMT +1. The time now is 04:29 AM.

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