Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 70
Default Save Workbook

Hi there,
have following code:
ChDir "M:\"
ActiveWorkbook.SaveAs Filename:= _
Application.InputBox("Enter Save as File Name") & ".xls" _
, FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
works fine but is there a way to disable the Close button in the box? If I
click on it it saves the file as False. Also, if I click on Cancel button it
saves as False. So what I want is that if the user clicks on accident on the
Close button that nothing happens and if they click on Cancel button to mayve
have a message saying Must Type File Name. This way it will force the users
to put somethin instead of the file saving as False.
Any ideas?
Really appreciate.
Juan

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 128
Default Save Workbook

Don't know your level of programming but not create a new userform and do the
following

place to buttons on it, one for saving and one to cancel

on this form insert a textbox for people to enter the save file data in

then insert this code into the userform and its problem solved as it works
fine on my system

Private Sub CommandButton1_Click()

Filename = TextBox1.Value

If TextBox1.Value = "" Then
MsgBox "please enter a name for the file"
Else

ChDir "C:\"
ActiveWorkbook.SaveAs Filename:="" & Filename & ".xls", FileFormat:
=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
UserForm1.Hide

End If

End Sub

Private Sub CommandButton2_Click()
UserForm1.Hide
End Sub

let me know how you get on

--
Message posted via http://www.officekb.com
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Save Workbook

Dim fName as Variant
Dim cnt as Long
ChDrive "M"
ChDir "M:\"
cnt = 0
do
fname = Application.GetSaveAsFileName(fileFilter:= _
"Excel Files (*.xls), *.xls)
cnt = cnt + 1
if cnt 3 then exit sub
loop while fName = False

ActiveWorkbook.SaveAs Filename:= _
fName, _
FileFormat:=xlNormal)


--
Regards,
Tom Ogilvy



"Juan" wrote in message
...
Hi there,
have following code:
ChDir "M:\"
ActiveWorkbook.SaveAs Filename:= _
Application.InputBox("Enter Save as File Name") & ".xls" _
, FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
works fine but is there a way to disable the Close button in the box? If I
click on it it saves the file as False. Also, if I click on Cancel button

it
saves as False. So what I want is that if the user clicks on accident on

the
Close button that nothing happens and if they click on Cancel button to

mayve
have a message saying Must Type File Name. This way it will force the

users
to put somethin instead of the file saving as False.
Any ideas?
Really appreciate.
Juan



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Shared workbook - to save or not to save bluebird Excel Discussion (Misc queries) 1 November 14th 06 06:17 PM
Select sheet tabs in workbook & save to separate workbook files stratocaster Excel Worksheet Functions 2 March 1st 06 03:35 PM
Using interop.excel to open a workbook, the workbook doesn't ask to save changes. [email protected] Excel Programming 1 December 28th 05 10:23 PM
Help on Workbook close and workbook save events Adam Harding Excel Programming 1 September 29th 05 04:12 PM
What commands do you use to name a workbook, save a workbook,open a workbook Steven R. Berke Excel Programming 1 July 24th 03 11:37 PM


All times are GMT +1. The time now is 10:28 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"