little help with code please.... lenze?

dandetroit

New Member
Joined
Sep 16, 2002
Messages
15
I am a novice at code and need a little help to complete the code below. Please indicate what information I need to fill in to complete the code. Thank you! PS... I don't need to password protect.


Sub NameBook()

Dim MyName
MyName = ActiveCell.Text

ActiveWorkbook.SaveAs _
FileName:="C:\MyFolder\" & MyName, _
FileFormat:=xlNormal, _
Password:="", _
WriteResPassword:="", _
ReadOnlyRecommended:=False, _
CreateBackup:=False

End Sub
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
Sub Save_Book()

Dim MyName

MyName = Activecell
FileName = "C:MyFolder" & MyName
ActiveWorkBook.SaveAs (FileName)

End Sub

Try this code

GNaga
 
Upvote 0
On 2002-09-17 07:26, dandetroit wrote:
I am a novice at code and need a little help to complete the code below. Please indicate what information I need to fill in to complete the code. Thank you! PS... I don't need to password protect.


Sub NameBook()

Dim MyName
MyName = ActiveCell.Text

ActiveWorkbook.SaveAs _
FileName:="C:\MyFolder\" & MyName, _
FileFormat:=xlNormal, _
Password:="", _
WriteResPassword:="", _
ReadOnlyRecommended:=False, _
CreateBackup:=False

End Sub

The code here will save the file with the name of the contents of the active cell. You need to change MyFolder to the directory you use on your computer. If you will always have the desired name in the same cell, say $A$1, then you can subsititute ActiveCell.Text with Range("$A$1")

The second sub I posted will negate the need to hard code a directory and will prompt for one when you save using the macro. Note: neither code runs when you select save on the menu bar. you must actively run the macro from the Macro menu or from a custom button or shortcut key.

HTH
 
Upvote 0

Forum statistics

Threads
1,214,826
Messages
6,121,792
Members
449,048
Latest member
greyangel23

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top