![]() |
Drop xls ext
Hi Everybody, still trying to learn VB, but I can not find the answer to this.
My macro opens a .xls file and then afterwards saves it as a .csv, the variable f has the File Name including the ext .xls, when saved I end up with MyFile.xls.csv How can I lose the xls ext? Code Used F = Application.GetOpenFilename("XL Files (*.xl*), *.XL*") If F = False Then Exit Sub Workbooks.Open F ActiveWorkbook.SaveAs FileName:= _ "C:\...\" & F & ".csv", FileFormat _ :=xlCSV, Many Thanks in anticipation |
Drop xls ext
One way:
If Right(F, 4) Like ".xl?" Then _ F = Left(F, LEN(F) - 4) & ".csv" ActiveWorkbook.SaveAs _ FileName:="C:\\...\" & F, _ FileFormat:=xlCSV In article , "PraxisPete" wrote: Hi Everybody, still trying to learn VB, but I can not find the answer to this. My macro opens a .xls file and then afterwards saves it as a .csv, the variable f has the File Name including the ext .xls, when saved I end up with MyFile.xls.csv How can I lose the xls ext? Code Used F = Application.GetOpenFilename("XL Files (*.xl*), *.XL*") If F = False Then Exit Sub Workbooks.Open F ActiveWorkbook.SaveAs FileName:= _ "C:\...\" & F & ".csv", FileFormat _ :=xlCSV, Many Thanks in anticipation |
Drop xls ext
Thanks JE it worked a treat.
"JE McGimpsey" wrote: One way: If Right(F, 4) Like ".xl?" Then _ F = Left(F, LEN(F) - 4) & ".csv" ActiveWorkbook.SaveAs _ FileName:="C:\\...\" & F, _ FileFormat:=xlCSV In article , "PraxisPete" wrote: Hi Everybody, still trying to learn VB, but I can not find the answer to this. My macro opens a .xls file and then afterwards saves it as a .csv, the variable f has the File Name including the ext .xls, when saved I end up with MyFile.xls.csv How can I lose the xls ext? Code Used F = Application.GetOpenFilename("XL Files (*.xl*), *.XL*") If F = False Then Exit Sub Workbooks.Open F ActiveWorkbook.SaveAs FileName:= _ "C:\...\" & F & ".csv", FileFormat _ :=xlCSV, Many Thanks in anticipation |
All times are GMT +1. The time now is 04:21 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com