The best way is to make a copy of the worksheet and save the copy like this.
I closed the CSV file after the Copy was made. Excel always changes the
filename whereever you do a saveas.
Private Sub CommandButton1_Click()
Call SaveToDesktop
End Sub
Sub SaveToDesktop()
Dim DTAddress As String
DTAddress = CreateObject("WScript.Shell").SpecialFolders
("Desktop") & Application.PathSeparator
set NewBk = ActiveSheet.copy
NewBk.SaveAs DTAddress & "1 EDSPubVMIActivity 852_1
200000080.csv", FileFormat:=xlCSV, CreateBackup:=False
NewBk.close savechanges:=False
End Sub
"(E-Mail Removed)" wrote:
> I am trying to create an excel file that has a command button that
> saves the file on desktop as .csv but everytime by clicking on the
> command button it is changing the name of my active excel sheet and
> saving on the desktop.
> below is the code:-
>
> Private Sub CommandButton1_Click()
> Call SaveToDesktop
> End Sub
> Sub SaveToDesktop()
> Dim DTAddress As String
> DTAddress = CreateObject("WScript.Shell").SpecialFolders
> ("Desktop") & Application.PathSeparator
>
> ActiveWorkbook.SaveCopyAs DTAddress & "1 EDSPubVMIActivity 852_1
> 200000080.csv", FileFormat:=xlCSV, CreateBackup:=False
> End Sub
>
> then further I have connect this file to internet and FTP it could you
> please help with the above problem ?
> its urgent
>
>
>
|