Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 " 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Code to create dbase file from text file? | Excel Discussion (Misc queries) | |||
How do I create a .bat file to create a shortcut on the desktop? | Excel Programming | |||
Possible to create XL file then run XL VBA (to format & filter XL file) from Access VBA? | Excel Discussion (Misc queries) | |||
Create CSV file based on table in Excel file | Excel Programming | |||
Create a batch file from a number of Excel File | Excel Programming |