![]() |
Help in vba
Hi everyboby..
I am new to this group, I hope u people can help me out.. I have a vba application... when i click a button i should be able to duplicate a csv file with a new name in the desired location of user .. Thanks and regards Hoping a valuable reply |
Help in vba
Do you need the user to search for the csv file to duplicate or will he be
saving a copy of the workbook he's in? If you need to search for the file, you'll need to prompt the user with something like this: Sub copyCSVfile() Dim sSourceCSVfile As String Dim sNewCSVfile As String Dim wbCSV As Workbook ' Get source file Do sSourceCSVfile = Application.GetOpenFilename(FileFilter:="CSV Files (*.csv), _ *.csv") Loop While (sSourceCSVfile = "False") ' Open the file Set wbCSV = Workbooks.Open(Filename:=sSourceCSVfile, ReadOnly:=True) ' Get new name Do sNewCSVfile = Application.GetSaveAsFilename(InitialFileName:=Lef t _(wbCSV.Name, Len(wbCSV.Name) - 4) & " copy", FileFilter:="CSV Files (*.csv), _ *.csv") Loop While (sNewCSVfile = "False") ' Save a copy and close wbCSV.SaveAs Filename:=sNewCSVfile wbCSV.Close SaveChanges:=False Set wbCSV = Nothing End Sub HTH, Matthew Pfluger "DareDevil" wrote: Hi everyboby.. I am new to this group, I hope u people can help me out.. I have a vba application... when i click a button i should be able to duplicate a csv file with a new name in the desired location of user .. Thanks and regards Hoping a valuable reply |
Help in vba
Have you looked in the help index for NAME
-- Don Guillett Microsoft MVP Excel SalesAid Software "DareDevil" wrote in message ... Hi everyboby.. I am new to this group, I hope u people can help me out.. I have a vba application... when i click a button i should be able to duplicate a csv file with a new name in the desired location of user .. Thanks and regards Hoping a valuable reply |
All times are GMT +1. The time now is 07:26 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com