ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Simple use of Len? (https://www.excelbanter.com/excel-programming/281947-simple-use-len.html)

Stuart[_5_]

Simple use of Len?
 
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



Ray at[_2_]

Simple use of Len?
 
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





Stuart[_5_]

Simple use of Len?
 
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



Tom Ogilvy

Simple use of Len?
 
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





Stuart[_5_]

Simple use of Len?
 
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



Tom Ogilvy

Simple use of Len?
 
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





Stuart[_5_]

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




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

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