create .csv and thn FTP tht file


V

vishakha.ranjeeta

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
 
Ad

Advertisements

J

Joel

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top