Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel,microsoft.public.excel.newusers,microsoft.public.excel.programming,microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 6
Default Button Error - Save at location

I have copied the code for this button.

The purpose of the button is to save the excel sheet at a specific location,
and to save it. I want a prompt box to appear, which asks what name the user
wants to save it as. Usually this name will be the date.

I am getting this message:
Message: Run time error: '424'
Debug = MyFileName = "MyName" & UserForm1.TextBox1 & ".xls" 'Create the
File Name
----------------------------------------------------------------------------
---------------------------------------------------------

Private Sub CommandButton1_Click()
MyPath = "s:shared\Enforcement, Enquiry & Complaints" 'Set
the Path
MyFileName = "MyName" & UserForm1.TextBox1 & ".xls" 'Create the File Name
MySaveString = MyPath & MyFileName 'String the two together

ActiveWorkbook.SaveAs Filename:= _
MySaveString, FileFormat:= _
xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
End Sub

Private Sub UserForm_Initialize()
Me.TextBox1 = Date
End Sub
Private Sub TextBox1_Change()

End Sub

----------------------------------------------------------------------------
-------------------------------------------------------------

Please help




  #2   Report Post  
Posted to microsoft.public.excel,microsoft.public.excel.newusers,microsoft.public.excel.programming,microsoft.public.excel.worksheet.functions
jaf jaf is offline
external usenet poster
 
Posts: 300
Default Button Error - Save at location

Hi Ravi,
Textbox1 is an object.
Change MyFileName = "MyName" & UserForm1.TextBox1 & ".xls" 'Create the
File Name
to: MyFileName = "MyName" & UserForm1.TextBox1.text & ".xls" 'Create the
File Name


--
John
johnf 202 at hotmail dot com


"Ravi Sandhu" wrote in message
...
| I have copied the code for this button.
|
| The purpose of the button is to save the excel sheet at a specific
location,
| and to save it. I want a prompt box to appear, which asks what name the
user
| wants to save it as. Usually this name will be the date.
|
| I am getting this message:
| Message: Run time error: '424'
| Debug = MyFileName = "MyName" & UserForm1.TextBox1 & ".xls" 'Create the
| File Name
| --------------------------------------------------------------------------
--
| ---------------------------------------------------------
|
| Private Sub CommandButton1_Click()
| MyPath = "s:shared\Enforcement, Enquiry & Complaints" 'Set
| the Path
| MyFileName = "MyName" & UserForm1.TextBox1 & ".xls" 'Create the File
Name
| MySaveString = MyPath & MyFileName 'String the two together
|
| ActiveWorkbook.SaveAs Filename:= _
| MySaveString, FileFormat:= _
| xlNormal, Password:="", WriteResPassword:="", _
| ReadOnlyRecommended:=False, CreateBackup:=False
| End Sub
|
| Private Sub UserForm_Initialize()
| Me.TextBox1 = Date
| End Sub
| Private Sub TextBox1_Change()
|
| End Sub
|
| --------------------------------------------------------------------------
--
| -------------------------------------------------------------
|
| Please help
|
|
|
|


  #3   Report Post  
Posted to microsoft.public.excel,microsoft.public.excel.newusers,microsoft.public.excel.programming,microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,885
Default Button Error - Save at location

Hi Ravi
you're trying to use the object reference in the string concatenation.
Try
MyFileName = "MyName" & UserForm1.TextBox1.text & ".xls"

HTH
Frank

Ravi Sandhu wrote:
I have copied the code for this button.

The purpose of the button is to save the excel sheet at a specific
location, and to save it. I want a prompt box to appear, which asks
what name the user wants to save it as. Usually this name will be the
date.

I am getting this message:
Message: Run time error: '424'
Debug = MyFileName = "MyName" & UserForm1.TextBox1 & ".xls"
'Create the File Name
---------------------------------------------------------------------

-------
---------------------------------------------------------

Private Sub CommandButton1_Click()
MyPath = "s:shared\Enforcement, Enquiry & Complaints"
'Set the Path
MyFileName = "MyName" & UserForm1.TextBox1 & ".xls" 'Create the
File Name MySaveString = MyPath & MyFileName 'String the two
together

ActiveWorkbook.SaveAs Filename:= _
MySaveString, FileFormat:= _
xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
End Sub

Private Sub UserForm_Initialize()
Me.TextBox1 = Date
End Sub
Private Sub TextBox1_Change()

End Sub

---------------------------------------------------------------------

-------
-------------------------------------------------------------

Please help



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
Macro - save to current location vs excel default location leezard Excel Discussion (Misc queries) 0 October 28th 08 03:04 PM
compile/syntax error to save active book to new location on networ Sharon Excel Worksheet Functions 2 March 14th 07 07:51 PM
how to get disk icon on save button of save as dialog like 2000 RichT Excel Discussion (Misc queries) 2 March 9th 06 08:13 PM
Button - Save Location Ravi Sandhu Excel Programming 0 February 3rd 04 10:07 PM
Location of control button Thomas Tremain Excel Programming 7 November 25th 03 04:33 AM


All times are GMT +1. The time now is 04:55 PM.

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

About Us

"It's about Microsoft Excel"