How to "Replace()" multiple characters in one VBA command line
XL 2003 & 2007
ActiveCell.formula is: ='P:\DMB\NCCRS\[$119M Distribution Summary - 3-31-2007 (4-9-2007).xls] I would like to remove =' and [ and ] in the most efficient manner. to get to a string which can be used to "Open" a file with "FilePathName" Current I do it as follows: FilePathName = replace(FilePathName,"='","") FilePathName = replace(FilePathName,"[","") FilePathName = replace(FilePathName,"]","") Is there a better way? TIA EagleOne |
How to "Replace()" multiple characters in one VBA command line
One way:
FilePathName = Mid(Replace(Replace( _ FilePathName, "[", ""), "]", ""), 3) In article . com, "EagleOne" wrote: XL 2003 & 2007 ActiveCell.formula is: ='P:\DMB\NCCRS\[$119M Distribution Summary - 3-31-2007 (4-9-2007).xls] I would like to remove =' and [ and ] in the most efficient manner. to get to a string which can be used to "Open" a file with "FilePathName" Current I do it as follows: FilePathName = replace(FilePathName,"='","") FilePathName = replace(FilePathName,"[","") FilePathName = replace(FilePathName,"]","") Is there a better way? TIA EagleOne |
All times are GMT +1. The time now is 05:09 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com