Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
IF formula-simple question; simple operator | Excel Discussion (Misc queries) | |||
Simple problem, simple formula, no FUNCTION ! | Excel Worksheet Functions | |||
Simple lookup - or maybe not so simple - help! | Excel Worksheet Functions | |||
Simple Simple Excel usage question | Excel Discussion (Misc queries) | |||
Make it more simple or intuitive to do simple things | Charts and Charting in Excel |