Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 413
Default 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


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default 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




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 413
Default 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


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 413
Default 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




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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




  #7   Report Post  
Posted to microsoft.public.excel.programming
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


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
IF formula-simple question; simple operator Rich D Excel Discussion (Misc queries) 4 December 6th 07 03:36 PM
Simple problem, simple formula, no FUNCTION ! Ron@Buy Excel Worksheet Functions 6 September 28th 07 04:51 PM
Simple lookup - or maybe not so simple - help! ChrisHodds Excel Worksheet Functions 1 September 27th 06 03:09 PM
Simple Simple Excel usage question BookerW Excel Discussion (Misc queries) 1 June 23rd 05 10:06 PM
Make it more simple or intuitive to do simple things Vernie Charts and Charting in Excel 1 March 16th 05 04:01 AM


All times are GMT +1. The time now is 03:28 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"