View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
Stuart[_5_] Stuart[_5_] is offline
external usenet poster
 
Posts: 413
Default Simple use of Len?

Thanks for 'substitute' and also for the 'Len' example.

Regards.

"Tom Ogilvy" wrote in message
...
sFileName = application.substitute(sfilename, "doc", "xls")


or

sfilename = Left(sfilename,len(sFilename)-4) & ".xls"

should work in all versions of Excel that support VBA.

--
Regards,
Tom Ogilvy



Stuart wrote in message
...
That is very handy to know !
Many thanks.

Would a 'Len' solution be backwards-compatible
with my users? Their earliest version is Excel'97.

Regards.

"Tom Ogilvy" wrote in message
...
Just make sure you don't use this code in a version of excel earlier

than
xl2000 where it was introduced.

--
Regards,
Tom Ogilvy

Stuart wrote in message
...
So, goodbye to Len.

Thanks for that.

Regards.

"Ray at <%=sLocation%" <myfirstname at lane 34 . komm wrote in

message
...
filename = Replace(filename, ".doc", ".xls")

Ray at home


"Stuart" wrote in message
...
vFileName holds the full path and filename of a Word
document opened via Excel VBA.

A new workbook is created, and data is imported from
the Word document.

Before I save the new workbook, how can I use LEN
to simply change vFileName to end as *.xls, rather
than its' current *.doc, please?

Regards.


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.536 / Virus Database: 331 - Release Date:

03/11/2003






---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.536 / Virus Database: 331 - Release Date: 03/11/2003






---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.536 / Virus Database: 331 - Release Date: 03/11/2003






---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.536 / Virus Database: 331 - Release Date: 03/11/2003