Referencing the file type

E

EvilTony

Hi,

Is it possoble for an Excel cell to 'know' what type of file it belongs to?

In other words, if a file is a template (ABC.xlt), can I display one value,
and if it has been saved as a workbook (ABC.xls) can I display a different
value?

I need to show/hide a prompt to save the file as a workbook after a change
has been made to the template.
 
G

Gary''s Student

There is probably an easier way, but in C1 enter:

=CELL("filename",A1)
this will display something like:

C:\Documents and Settings\Owner\Favorites\Links\e\spreads\[sendkey
experiment.xls]Sheet1

Note the extension is buried in there. The in another cell:

=IF(LEN(C1)=LEN(SUBSTITUTE(C1,"xls","")),"not xls","xls")
 
O

OssieMac

The following will return xls or xlt or Unknown Type if it is neither xls or
xlt. Note that it is one line although it breaks in this post

=IF(ISERROR(FIND(".xls]",CELL("Filename"),1)),IF(ISERROR(FIND(".xlt]",CELL("Filename"),1)),"Unknown Type","xlt"),"xls")

You can replace "Unknown Type" with "" to return a blank for neither xls or
xlt.
 
E

EvilTony

Thanks Gary's Student... that is perfect.

It appears that the filename of a template is blank until it is saved, which
is as informative for my purpose as if it had a name.


--
It''''s a little fit bunny, this feeling inside


Gary''s Student said:
There is probably an easier way, but in C1 enter:

=CELL("filename",A1)
this will display something like:

C:\Documents and Settings\Owner\Favorites\Links\e\spreads\[sendkey
experiment.xls]Sheet1

Note the extension is buried in there. The in another cell:

=IF(LEN(C1)=LEN(SUBSTITUTE(C1,"xls","")),"not xls","xls")
--
Gary''s Student - gsnu200841


EvilTony said:
Hi,

Is it possoble for an Excel cell to 'know' what type of file it belongs to?

In other words, if a file is a template (ABC.xlt), can I display one value,
and if it has been saved as a workbook (ABC.xls) can I display a different
value?

I need to show/hide a prompt to save the file as a workbook after a change
has been made to the template.
 
D

Dave Peterson

If you're using code, you can check the .path of the workbook.

If activeworkbook.path = "" then
'never been saved
else
'saved at least once
end if
Thanks Gary's Student... that is perfect.

It appears that the filename of a template is blank until it is saved, which
is as informative for my purpose as if it had a name.

--
It''''s a little fit bunny, this feeling inside

Gary''s Student said:
There is probably an easier way, but in C1 enter:

=CELL("filename",A1)
this will display something like:

C:\Documents and Settings\Owner\Favorites\Links\e\spreads\[sendkey
experiment.xls]Sheet1

Note the extension is buried in there. The in another cell:

=IF(LEN(C1)=LEN(SUBSTITUTE(C1,"xls","")),"not xls","xls")
--
Gary''s Student - gsnu200841


EvilTony said:
Hi,

Is it possoble for an Excel cell to 'know' what type of file it belongs to?

In other words, if a file is a template (ABC.xlt), can I display one value,
and if it has been saved as a workbook (ABC.xls) can I display a different
value?

I need to show/hide a prompt to save the file as a workbook after a change
has been made to the template.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top