Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Mo Mo is offline
external usenet poster
 
Posts: 69
Default macro to save as

I need to create a macro & assign it to a button. the macro needs to save
the current file based on a date that is entered in a cell. also the macro
needs to prompt the user to verify the filename(date) and then save it and
return to the current worksheet.

thanks

Mo
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default macro to save as

sFilename = Format(Worksheets("Sheet1").Range("A1").Value, "yyyy-mm-dd")
ans = MsgBox ("Save file as " & sFilename)
if ans = vbOK Then
Activeworkbook.SaveAs Filename:= sFilename
End If

should do it

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Mo" wrote in message
...
I need to create a macro & assign it to a button. the macro needs to save
the current file based on a date that is entered in a cell. also the

macro
needs to prompt the user to verify the filename(date) and then save it and
return to the current worksheet.

thanks

Mo



  #3   Report Post  
Posted to microsoft.public.excel.programming
Mo Mo is offline
external usenet poster
 
Posts: 69
Default macro to save as

Bob,

I got an error message - "Complie Error, Invalid outside procedure"
it highlite the ("A1")

"Bob Phillips" wrote:

sFilename = Format(Worksheets("Sheet1").Range("A1").Value, "yyyy-mm-dd")
ans = MsgBox ("Save file as " & sFilename)
if ans = vbOK Then
Activeworkbook.SaveAs Filename:= sFilename
End If

should do it

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Mo" wrote in message
...
I need to create a macro & assign it to a button. the macro needs to save
the current file based on a date that is entered in a cell. also the

macro
needs to prompt the user to verify the filename(date) and then save it and
return to the current worksheet.

thanks

Mo




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default macro to save as

You need to put it in a sub:-)

Sub SaveMyFile()
sFilename = Format(Worksheets("Sheet1").Range("A1").Value, "yyyy-mm-dd")
ans = MsgBox ("Save file as " & sFilename)
if ans = vbOK Then
Activeworkbook.SaveAs Filename:= sFilename
End If
End Sub

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Mo" wrote in message
...
Bob,

I got an error message - "Complie Error, Invalid outside procedure"
it highlite the ("A1")

"Bob Phillips" wrote:

sFilename = Format(Worksheets("Sheet1").Range("A1").Value,

"yyyy-mm-dd")
ans = MsgBox ("Save file as " & sFilename)
if ans = vbOK Then
Activeworkbook.SaveAs Filename:= sFilename
End If

should do it

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Mo" wrote in message
...
I need to create a macro & assign it to a button. the macro needs to

save
the current file based on a date that is entered in a cell. also the

macro
needs to prompt the user to verify the filename(date) and then save it

and
return to the current worksheet.

thanks

Mo






  #5   Report Post  
Posted to microsoft.public.excel.programming
Mo Mo is offline
external usenet poster
 
Posts: 69
Default macro to save as

Bob,
Thanks for your help. I will give it a try.
I have one general question to ask. How or (can) do I hide the worksheet
menu bar. I tried View, Toolbars, Customize and unclick the menu bar. But
it still defaulted to show the menu bar. My intention is to not allow the
user to delete, save as, or use other menus while in the work book. The
workbook is all driven by macros and there is no need for user to use or
"play" with the menu bar.

Thanks
Mo

"Bob Phillips" wrote:

You need to put it in a sub:-)

Sub SaveMyFile()
sFilename = Format(Worksheets("Sheet1").Range("A1").Value, "yyyy-mm-dd")
ans = MsgBox ("Save file as " & sFilename)
if ans = vbOK Then
Activeworkbook.SaveAs Filename:= sFilename
End If
End Sub

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Mo" wrote in message
...
Bob,

I got an error message - "Complie Error, Invalid outside procedure"
it highlite the ("A1")

"Bob Phillips" wrote:

sFilename = Format(Worksheets("Sheet1").Range("A1").Value,

"yyyy-mm-dd")
ans = MsgBox ("Save file as " & sFilename)
if ans = vbOK Then
Activeworkbook.SaveAs Filename:= sFilename
End If

should do it

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Mo" wrote in message
...
I need to create a macro & assign it to a button. the macro needs to

save
the current file based on a date that is entered in a cell. also the
macro
needs to prompt the user to verify the filename(date) and then save it

and
return to the current worksheet.

thanks

Mo








  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default macro to save as


Application.Commandbars("Worksheet Menu Bar").Enabled = False

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Mo" wrote in message
...
Bob,
Thanks for your help. I will give it a try.
I have one general question to ask. How or (can) do I hide the worksheet
menu bar. I tried View, Toolbars, Customize and unclick the menu bar.

But
it still defaulted to show the menu bar. My intention is to not allow the
user to delete, save as, or use other menus while in the work book. The
workbook is all driven by macros and there is no need for user to use or
"play" with the menu bar.

Thanks
Mo

"Bob Phillips" wrote:

You need to put it in a sub:-)

Sub SaveMyFile()
sFilename = Format(Worksheets("Sheet1").Range("A1").Value,

"yyyy-mm-dd")
ans = MsgBox ("Save file as " & sFilename)
if ans = vbOK Then
Activeworkbook.SaveAs Filename:= sFilename
End If
End Sub

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Mo" wrote in message
...
Bob,

I got an error message - "Complie Error, Invalid outside procedure"
it highlite the ("A1")

"Bob Phillips" wrote:

sFilename = Format(Worksheets("Sheet1").Range("A1").Value,

"yyyy-mm-dd")
ans = MsgBox ("Save file as " & sFilename)
if ans = vbOK Then
Activeworkbook.SaveAs Filename:= sFilename
End If

should do it

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Mo" wrote in message
...
I need to create a macro & assign it to a button. the macro needs

to
save
the current file based on a date that is entered in a cell. also

the
macro
needs to prompt the user to verify the filename(date) and then

save it
and
return to the current worksheet.

thanks

Mo








  #7   Report Post  
Posted to microsoft.public.excel.programming
Mo Mo is offline
external usenet poster
 
Posts: 69
Default macro to save as

Bob,

Can you look at this macro and let me know why its not working. I'm trying
to create a macro when prombted "yes", it will save file based on cell
contents prior to exiting Excel.

Thanks Mo

Sub cmdExit_Click()
Dim Response As String
Dim msg As String
Dim Style As String

msg = "Are you sure you want to Exit the application and Close Excel?"
Style = vbYesNo + vbInformation + vbDefaultButton2

Response = MsgBox(msg, Style)
If Response = vbYes Then
sFilename = Format(Worksheets("MainMenu").Range("C5").Value,
"mm-dd-yyyy")
ans = MsgBox("Save File As" & sFilename)
If ans = vbOK Then
ActiveWorkbook.SaveAs Filename:=sFilename
ActiveWorkbook.Close savechanges:=True
Application.Quit
Application.StatusBar = "Application Closing."
Else
ActiveWorkbook.Activate
End If

End Sub

"Bob Phillips" wrote:


Application.Commandbars("Worksheet Menu Bar").Enabled = False

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Mo" wrote in message
...
Bob,
Thanks for your help. I will give it a try.
I have one general question to ask. How or (can) do I hide the worksheet
menu bar. I tried View, Toolbars, Customize and unclick the menu bar.

But
it still defaulted to show the menu bar. My intention is to not allow the
user to delete, save as, or use other menus while in the work book. The
workbook is all driven by macros and there is no need for user to use or
"play" with the menu bar.

Thanks
Mo

"Bob Phillips" wrote:

You need to put it in a sub:-)

Sub SaveMyFile()
sFilename = Format(Worksheets("Sheet1").Range("A1").Value,

"yyyy-mm-dd")
ans = MsgBox ("Save file as " & sFilename)
if ans = vbOK Then
Activeworkbook.SaveAs Filename:= sFilename
End If
End Sub

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Mo" wrote in message
...
Bob,

I got an error message - "Complie Error, Invalid outside procedure"
it highlite the ("A1")

"Bob Phillips" wrote:

sFilename = Format(Worksheets("Sheet1").Range("A1").Value,
"yyyy-mm-dd")
ans = MsgBox ("Save file as " & sFilename)
if ans = vbOK Then
Activeworkbook.SaveAs Filename:= sFilename
End If

should do it

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Mo" wrote in message
...
I need to create a macro & assign it to a button. the macro needs

to
save
the current file based on a date that is entered in a cell. also

the
macro
needs to prompt the user to verify the filename(date) and then

save it
and
return to the current worksheet.

thanks

Mo









  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default macro to save as

Mo,

How about this?

Sub cmdExit_Click()
Dim Response As String
Dim msg As String
Dim Style As String
Dim sFilename As String
Dim ans

msg = "Are you sure you want to Exit the application and Close Excel?"
Style = vbYesNo + vbInformation + vbDefaultButton2

Response = MsgBox(msg, Style)
If Response = vbYes Then
sFilename = Format(Worksheets("MainMenu").Range("C5").Value,
"mm-dd-yyyy")
ans = MsgBox("Save File As " & sFilename)
If ans = vbOK Then
ActiveWorkbook.SaveAs Filename:=sFilename
Application.Quit
Application.StatusBar = "Application Closing."
End If
Else
ActiveWorkbook.Activate
End If

End Sub

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Mo" wrote in message
...
Bob,

Can you look at this macro and let me know why its not working. I'm

trying
to create a macro when prombted "yes", it will save file based on cell
contents prior to exiting Excel.

Thanks Mo

Sub cmdExit_Click()
Dim Response As String
Dim msg As String
Dim Style As String

msg = "Are you sure you want to Exit the application and Close Excel?"
Style = vbYesNo + vbInformation + vbDefaultButton2

Response = MsgBox(msg, Style)
If Response = vbYes Then
sFilename = Format(Worksheets("MainMenu").Range("C5").Value,
"mm-dd-yyyy")
ans = MsgBox("Save File As" & sFilename)
If ans = vbOK Then
ActiveWorkbook.SaveAs Filename:=sFilename
ActiveWorkbook.Close savechanges:=True
Application.Quit
Application.StatusBar = "Application Closing."
Else
ActiveWorkbook.Activate
End If

End Sub

"Bob Phillips" wrote:


Application.Commandbars("Worksheet Menu Bar").Enabled = False

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Mo" wrote in message
...
Bob,
Thanks for your help. I will give it a try.
I have one general question to ask. How or (can) do I hide the

worksheet
menu bar. I tried View, Toolbars, Customize and unclick the menu bar.

But
it still defaulted to show the menu bar. My intention is to not allow

the
user to delete, save as, or use other menus while in the work book.

The
workbook is all driven by macros and there is no need for user to use

or
"play" with the menu bar.

Thanks
Mo

"Bob Phillips" wrote:

You need to put it in a sub:-)

Sub SaveMyFile()
sFilename = Format(Worksheets("Sheet1").Range("A1").Value,

"yyyy-mm-dd")
ans = MsgBox ("Save file as " & sFilename)
if ans = vbOK Then
Activeworkbook.SaveAs Filename:= sFilename
End If
End Sub

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Mo" wrote in message
...
Bob,

I got an error message - "Complie Error, Invalid outside

procedure"
it highlite the ("A1")

"Bob Phillips" wrote:

sFilename = Format(Worksheets("Sheet1").Range("A1").Value,
"yyyy-mm-dd")
ans = MsgBox ("Save file as " & sFilename)
if ans = vbOK Then
Activeworkbook.SaveAs Filename:= sFilename
End If

should do it

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Mo" wrote in message
...
I need to create a macro & assign it to a button. the macro

needs
to
save
the current file based on a date that is entered in a cell.

also
the
macro
needs to prompt the user to verify the filename(date) and then

save it
and
return to the current worksheet.

thanks

Mo











  #9   Report Post  
Posted to microsoft.public.excel.programming
Mo Mo is offline
external usenet poster
 
Posts: 69
Default macro to save as

Bob,

I revised the macro to save to a specific path/directory. Your suggestion
was very helpful. I want the macro to do one more procedure. The macro
should give the user the option (yes or no) after the message of "Save File
As ...".

Sub cmdExit_Click()
Dim Response As String
Dim msg As String
Dim Style As String
Dim sPath As String
Dim sFilename As String
Dim ans

msg = "Are you sure you want to Exit the application and Close Excel?"
Style = vbYesNo + vbInformation + vbDefaultButton2

Response = MsgBox(msg, Style)
If Response = vbYes Then
sPath = "C:\MetroWest\"
sFilename = Format(Worksheets("MainMenu").Range("C5").Value,
"mm-dd-yyyy")
ans = MsgBox("Save File As " & sFilename)
If ans = vbOK Then
ActiveWorkbook.SaveAs sPath & sFilename
ActiveWorkbook.Close savechanges:=True
Application.Exit
Application.StatusBar = "Application Closing."
End If
Else
ActiveWorkbook.Activate
End If

End Sub



"Bob Phillips" wrote:

Mo,

How about this?

Sub cmdExit_Click()
Dim Response As String
Dim msg As String
Dim Style As String
Dim sFilename As String
Dim ans

msg = "Are you sure you want to Exit the application and Close Excel?"
Style = vbYesNo + vbInformation + vbDefaultButton2

Response = MsgBox(msg, Style)
If Response = vbYes Then
sFilename = Format(Worksheets("MainMenu").Range("C5").Value,
"mm-dd-yyyy")
ans = MsgBox("Save File As " & sFilename)
If ans = vbOK Then
ActiveWorkbook.SaveAs Filename:=sFilename
Application.Quit
Application.StatusBar = "Application Closing."
End If
Else
ActiveWorkbook.Activate
End If

End Sub

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Mo" wrote in message
...
Bob,

Can you look at this macro and let me know why its not working. I'm

trying
to create a macro when prombted "yes", it will save file based on cell
contents prior to exiting Excel.

Thanks Mo

Sub cmdExit_Click()
Dim Response As String
Dim msg As String
Dim Style As String

msg = "Are you sure you want to Exit the application and Close Excel?"
Style = vbYesNo + vbInformation + vbDefaultButton2

Response = MsgBox(msg, Style)
If Response = vbYes Then
sFilename = Format(Worksheets("MainMenu").Range("C5").Value,
"mm-dd-yyyy")
ans = MsgBox("Save File As" & sFilename)
If ans = vbOK Then
ActiveWorkbook.SaveAs Filename:=sFilename
ActiveWorkbook.Close savechanges:=True
Application.Quit
Application.StatusBar = "Application Closing."
Else
ActiveWorkbook.Activate
End If

End Sub

"Bob Phillips" wrote:


Application.Commandbars("Worksheet Menu Bar").Enabled = False

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Mo" wrote in message
...
Bob,
Thanks for your help. I will give it a try.
I have one general question to ask. How or (can) do I hide the

worksheet
menu bar. I tried View, Toolbars, Customize and unclick the menu bar.
But
it still defaulted to show the menu bar. My intention is to not allow

the
user to delete, save as, or use other menus while in the work book.

The
workbook is all driven by macros and there is no need for user to use

or
"play" with the menu bar.

Thanks
Mo

"Bob Phillips" wrote:

You need to put it in a sub:-)

Sub SaveMyFile()
sFilename = Format(Worksheets("Sheet1").Range("A1").Value,
"yyyy-mm-dd")
ans = MsgBox ("Save file as " & sFilename)
if ans = vbOK Then
Activeworkbook.SaveAs Filename:= sFilename
End If
End Sub

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Mo" wrote in message
...
Bob,

I got an error message - "Complie Error, Invalid outside

procedure"
it highlite the ("A1")

"Bob Phillips" wrote:

sFilename = Format(Worksheets("Sheet1").Range("A1").Value,
"yyyy-mm-dd")
ans = MsgBox ("Save file as " & sFilename)
if ans = vbOK Then
Activeworkbook.SaveAs Filename:= sFilename
End If

should do it

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Mo" wrote in message
...
I need to create a macro & assign it to a button. the macro

needs
to
save
the current file based on a date that is entered in a cell.

also
the
macro
needs to prompt the user to verify the filename(date) and then
save it
and
return to the current worksheet.

thanks

Mo












  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 258
Default macro to save as

Bob;
I wonder if you can help me with this problem.

I have an excel file "Products Weight.xls" that is located on the share
directory ("S drive"). This file has been used to load weight of the
different products found on the market so is basically a database.

The problem is that we have ten people doing this reseach and loading the
data they found and most of the time the ten people are loading the data at
the same time. Therefore, just one is able to load the data and save the
file. Meanwhile, the rest could not save because they have gotten this file
as a read only.

I wonder if there is any way to have a macro to allow the ten people to save
the file eventhougth it is open at the same time for all of them.
Could you please help me with this matter.

Thanks in advance.
Maperalia


"Bob Phillips" wrote:

Mo,

How about this?

Sub cmdExit_Click()
Dim Response As String
Dim msg As String
Dim Style As String
Dim sFilename As String
Dim ans

msg = "Are you sure you want to Exit the application and Close Excel?"
Style = vbYesNo + vbInformation + vbDefaultButton2

Response = MsgBox(msg, Style)
If Response = vbYes Then
sFilename = Format(Worksheets("MainMenu").Range("C5").Value,
"mm-dd-yyyy")
ans = MsgBox("Save File As " & sFilename)
If ans = vbOK Then
ActiveWorkbook.SaveAs Filename:=sFilename
Application.Quit
Application.StatusBar = "Application Closing."
End If
Else
ActiveWorkbook.Activate
End If

End Sub

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Mo" wrote in message
...
Bob,

Can you look at this macro and let me know why its not working. I'm

trying
to create a macro when prombted "yes", it will save file based on cell
contents prior to exiting Excel.

Thanks Mo

Sub cmdExit_Click()
Dim Response As String
Dim msg As String
Dim Style As String

msg = "Are you sure you want to Exit the application and Close Excel?"
Style = vbYesNo + vbInformation + vbDefaultButton2

Response = MsgBox(msg, Style)
If Response = vbYes Then
sFilename = Format(Worksheets("MainMenu").Range("C5").Value,
"mm-dd-yyyy")
ans = MsgBox("Save File As" & sFilename)
If ans = vbOK Then
ActiveWorkbook.SaveAs Filename:=sFilename
ActiveWorkbook.Close savechanges:=True
Application.Quit
Application.StatusBar = "Application Closing."
Else
ActiveWorkbook.Activate
End If

End Sub

"Bob Phillips" wrote:


Application.Commandbars("Worksheet Menu Bar").Enabled = False

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Mo" wrote in message
...
Bob,
Thanks for your help. I will give it a try.
I have one general question to ask. How or (can) do I hide the

worksheet
menu bar. I tried View, Toolbars, Customize and unclick the menu bar.
But
it still defaulted to show the menu bar. My intention is to not allow

the
user to delete, save as, or use other menus while in the work book.

The
workbook is all driven by macros and there is no need for user to use

or
"play" with the menu bar.

Thanks
Mo

"Bob Phillips" wrote:

You need to put it in a sub:-)

Sub SaveMyFile()
sFilename = Format(Worksheets("Sheet1").Range("A1").Value,
"yyyy-mm-dd")
ans = MsgBox ("Save file as " & sFilename)
if ans = vbOK Then
Activeworkbook.SaveAs Filename:= sFilename
End If
End Sub

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Mo" wrote in message
...
Bob,

I got an error message - "Complie Error, Invalid outside

procedure"
it highlite the ("A1")

"Bob Phillips" wrote:

sFilename = Format(Worksheets("Sheet1").Range("A1").Value,
"yyyy-mm-dd")
ans = MsgBox ("Save file as " & sFilename)
if ans = vbOK Then
Activeworkbook.SaveAs Filename:= sFilename
End If

should do it

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Mo" wrote in message
...
I need to create a macro & assign it to a button. the macro

needs
to
save
the current file based on a date that is entered in a cell.

also
the
macro
needs to prompt the user to verify the filename(date) and then
save it
and
return to the current worksheet.

thanks

Mo














  #11   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default macro to save as

Hi, I tried this, BUT how do i get the Menu Bar back, cos now i cant get it
back, please.

Thanks

"Bob Phillips" wrote:


Application.Commandbars("Worksheet Menu Bar").Enabled = False

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Mo" wrote in message
...
Bob,
Thanks for your help. I will give it a try.
I have one general question to ask. How or (can) do I hide the worksheet
menu bar. I tried View, Toolbars, Customize and unclick the menu bar.

But
it still defaulted to show the menu bar. My intention is to not allow the
user to delete, save as, or use other menus while in the work book. The
workbook is all driven by macros and there is no need for user to use or
"play" with the menu bar.

Thanks
Mo

"Bob Phillips" wrote:

You need to put it in a sub:-)

Sub SaveMyFile()
sFilename = Format(Worksheets("Sheet1").Range("A1").Value,

"yyyy-mm-dd")
ans = MsgBox ("Save file as " & sFilename)
if ans = vbOK Then
Activeworkbook.SaveAs Filename:= sFilename
End If
End Sub

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Mo" wrote in message
...
Bob,

I got an error message - "Complie Error, Invalid outside procedure"
it highlite the ("A1")

"Bob Phillips" wrote:

sFilename = Format(Worksheets("Sheet1").Range("A1").Value,
"yyyy-mm-dd")
ans = MsgBox ("Save file as " & sFilename)
if ans = vbOK Then
Activeworkbook.SaveAs Filename:= sFilename
End If

should do it

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Mo" wrote in message
...
I need to create a macro & assign it to a button. the macro needs

to
save
the current file based on a date that is entered in a cell. also

the
macro
needs to prompt the user to verify the filename(date) and then

save it
and
return to the current worksheet.

thanks

Mo









  #12   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default macro to save as

Try changing the False to True

and reexecuting that statement

Nazzy wrote:

Hi, I tried this, BUT how do i get the Menu Bar back, cos now i cant get it
back, please.

Thanks

"Bob Phillips" wrote:


Application.Commandbars("Worksheet Menu Bar").Enabled = False

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Mo" wrote in message
...
Bob,
Thanks for your help. I will give it a try.
I have one general question to ask. How or (can) do I hide the worksheet
menu bar. I tried View, Toolbars, Customize and unclick the menu bar.

But
it still defaulted to show the menu bar. My intention is to not allow the
user to delete, save as, or use other menus while in the work book. The
workbook is all driven by macros and there is no need for user to use or
"play" with the menu bar.

Thanks
Mo

"Bob Phillips" wrote:

You need to put it in a sub:-)

Sub SaveMyFile()
sFilename = Format(Worksheets("Sheet1").Range("A1").Value,

"yyyy-mm-dd")
ans = MsgBox ("Save file as " & sFilename)
if ans = vbOK Then
Activeworkbook.SaveAs Filename:= sFilename
End If
End Sub

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Mo" wrote in message
...
Bob,

I got an error message - "Complie Error, Invalid outside procedure"
it highlite the ("A1")

"Bob Phillips" wrote:

sFilename = Format(Worksheets("Sheet1").Range("A1").Value,
"yyyy-mm-dd")
ans = MsgBox ("Save file as " & sFilename)
if ans = vbOK Then
Activeworkbook.SaveAs Filename:= sFilename
End If

should do it

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Mo" wrote in message
...
I need to create a macro & assign it to a button. the macro needs

to
save
the current file based on a date that is entered in a cell. also

the
macro
needs to prompt the user to verify the filename(date) and then

save it
and
return to the current worksheet.

thanks

Mo










--

Dave Peterson
  #13   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default macro to save as

But i cant do that cos when im in Excel i cant see the menu bar with
Tools-Macros. So how do I get to edit the macro...cos i cant see the Tools
menu to get into the macro.

"Dave Peterson" wrote:

Try changing the False to True

and reexecuting that statement

Nazzy wrote:

Hi, I tried this, BUT how do i get the Menu Bar back, cos now i cant get it
back, please.

Thanks

"Bob Phillips" wrote:


Application.Commandbars("Worksheet Menu Bar").Enabled = False

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Mo" wrote in message
...
Bob,
Thanks for your help. I will give it a try.
I have one general question to ask. How or (can) do I hide the worksheet
menu bar. I tried View, Toolbars, Customize and unclick the menu bar.
But
it still defaulted to show the menu bar. My intention is to not allow the
user to delete, save as, or use other menus while in the work book. The
workbook is all driven by macros and there is no need for user to use or
"play" with the menu bar.

Thanks
Mo

"Bob Phillips" wrote:

You need to put it in a sub:-)

Sub SaveMyFile()
sFilename = Format(Worksheets("Sheet1").Range("A1").Value,
"yyyy-mm-dd")
ans = MsgBox ("Save file as " & sFilename)
if ans = vbOK Then
Activeworkbook.SaveAs Filename:= sFilename
End If
End Sub

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Mo" wrote in message
...
Bob,

I got an error message - "Complie Error, Invalid outside procedure"
it highlite the ("A1")

"Bob Phillips" wrote:

sFilename = Format(Worksheets("Sheet1").Range("A1").Value,
"yyyy-mm-dd")
ans = MsgBox ("Save file as " & sFilename)
if ans = vbOK Then
Activeworkbook.SaveAs Filename:= sFilename
End If

should do it

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Mo" wrote in message
...
I need to create a macro & assign it to a button. the macro needs
to
save
the current file based on a date that is entered in a cell. also
the
macro
needs to prompt the user to verify the filename(date) and then
save it
and
return to the current worksheet.

thanks

Mo










--

Dave Peterson

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 to Insert Current Date into cell - Macro to "Save As" Guy[_2_] Excel Worksheet Functions 4 December 12th 08 08:20 PM
Macro to Save without the Save Message Ellen G Excel Discussion (Misc queries) 4 February 23rd 07 08:52 PM
Save As macro BigDave[_4_] Excel Programming 3 June 8th 05 05:10 PM
ASP: Open Excel File with Macro, Allow Macro to run, and then save delgados129 Excel Programming 0 March 10th 05 09:35 PM
Prompted to save changes after macro save - why? Izar Arcturus Excel Programming 2 December 10th 03 09:27 PM


All times are GMT +1. The time now is 03:01 AM.

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"