ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   command button to save (https://www.excelbanter.com/excel-programming/391893-command-button-save.html)

shootz

command button to save
 
I am trying to open a save from button 3 for just the worksheet not the whole
workbook. I am really new at this I have two tries..help

Private Sub CommandButton3_Click()
fileSaveName = Application.GetSaveAsFilename(fileFilter:="Microso ft Excel
Workbook (*.xls), *.xls")
ActiveWorkbook.SaveAs Filename:=fileSaveName
End Sub
or
Dim vResponse As Variant

vResponse = Application.GetSaveAsFilename( _
FileFilter:="Microsoft Excel Files (*.xls), *.xls", _
Title:="Please select your file")
ActiveWorkbook.SaveAs Filename:=fileSaveName
If vResponse < False Then
MsgBox Prompt:="You selected '" & vResponse & "'.", _
Buttons:=vbOKOnly Or vbInformation
Else
MsgBox Prompt:="You cancelled.", _
Buttons:=vbOKOnly Or vbInformation
End If
End Sub




or



tissot.emmanuel

command button to save
 
Hi,

To save a worksheet you have to put in a new workbook like this:
ActiveSheet.Move
Or like this:
ActiveSheet.Copy
Then you save the new workbook.

Private Sub CommandButton3_Click()
Dim vResponse As Variant
vResponse = Application.GetSaveAsFilename(FileFilter:="Microso ft Excel
Files (*.xls), *.xls", _
Title:="Please select your file")
If vResponse < False Then
ActiveSheet.Move 'ActiveSheet.Copy 'depending what you needs
ActiveWorkbook.SaveAs Filename:=vResponse
Else
MsgBox "You cancelled.", vbOKOnly + vbInformation
End If
End Sub

Regards,

Manu/

"shootz" a écrit dans le message de news:
...
I am trying to open a save from button 3 for just the worksheet not the
whole
workbook. I am really new at this I have two tries..help

Private Sub CommandButton3_Click()
fileSaveName = Application.GetSaveAsFilename(fileFilter:="Microso ft Excel
Workbook (*.xls), *.xls")
ActiveWorkbook.SaveAs Filename:=fileSaveName
End Sub
or
Dim vResponse As Variant

vResponse = Application.GetSaveAsFilename( _
FileFilter:="Microsoft Excel Files (*.xls), *.xls", _
Title:="Please select your file")
ActiveWorkbook.SaveAs Filename:=fileSaveName
If vResponse < False Then
MsgBox Prompt:="You selected '" & vResponse & "'.", _
Buttons:=vbOKOnly Or vbInformation
Else
MsgBox Prompt:="You cancelled.", _
Buttons:=vbOKOnly Or vbInformation
End If
End Sub




or






All times are GMT +1. The time now is 03:33 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com