Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 9
Default Referencing the file type

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.

--
It''s a little fit bunny, this feeling inside
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default Referencing the file type

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" wrote:

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.

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

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,510
Default Referencing the file type

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.

--
Regards,

OssieMac


"EvilTony" wrote:

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.

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

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 9
Default Referencing the file type

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" wrote:

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" wrote:

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.

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

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Referencing the file type

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

EvilTony wrote:

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" wrote:

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" wrote:

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.

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


--

Dave Peterson
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
Saved *.csv file gives SYLK file type warning upon Excel 2003 open Tom Excel Discussion (Misc queries) 5 March 19th 08 03:15 PM
How do you save an excel file to be read as IBM-type text file ? Dee Franklin Excel Worksheet Functions 2 October 10th 06 02:46 AM
when inserting a file name in a cell how do you remove file type mikecarpenter21 Excel Worksheet Functions 1 August 3rd 06 05:42 PM
Referencing a 2nd file [email protected] Excel Discussion (Misc queries) 1 May 28th 06 07:24 AM
How do I change file/open/"files of type" to default to "all file. How do I changefiles of type default Excel Discussion (Misc queries) 1 April 19th 05 10:45 PM


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

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

About Us

"It's about Microsoft Excel"