LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 469
Default Automated Saving of File

trying to save a file think what I read is more than I need?
useing
Answer = MsgBox(" Have you made a backup of this data?", vbYesNo)
If Answer = vbNo Then
FileSaveName = Application.GetSaveAsFilename( _
fileFilter:="Text Files (*.txt),*.txt")
If FileSaveName < False Then
MsgBox "Save as" & FileSaveName
End If
Range("e3")(DataEntry).Select
End If
Answer = MsgBox(" Confirm backup of this data. Click Yes", vbYesNo)
If Answer = vbYes Then

Missing something as it does not save when named in save as box?
want user to give Active worlsheet a name then save befor other action
clearing data. Any help appreciated Thanks

"Ed" wrote:

With your master timesheet file open, press ALT+F11. This opens the Visual
Basic Editor (VBE). You should see an Explorer-like tree on the left side.
Find the name of the master timesheet file. If there are no icons for each
sheet and ThisWorkbook below it, then double-click the workbook icon.

Double-click the ThisWorkbook icon. The left side upper rectangle will
probably show General; if so, click the drop-down arrow to select Workbook.
It will probably change the right side upper rectangle to Open, and put
Private Sub Workbook_Open()

End Sub
in the VBE window. Use the drop-down arrow on the right rectangle to select
BeforeSave. A new macro header should appear as
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)

End Sub

Copy the following code and paste it in the space between "Private Sub" and
"End Sub".

'Create string variable for file name
Dim strFName As String
'Set file path in string
strFName = "C:\timesheet\"
' Check if A1 is empty
If Worksheets("January").Range("A1") < "" Then
'If not, then verify name
If MsgBox("Is your name in Cell A1 of January?", vbYesNo) = vbYes Then
'If name is correct, add to file name string
strFName = strFName & Range("A1") & ".xls"
' Save file
Me.SaveAs strFName
Else
'If name is not correct, prompt to change it
MsgBox "Please type your name in Cell A1 of January."
'Cancel save
Cancel = True
End If
Else
'Prompt for name
MsgBox "Please type your name into Cell A1 of January."
' Cancel save
Cancel = True
End If

HTH
Ed

"SU" wrote in message
...
I am trying to prompt users with a message (when they click/use SAVE) to

fill
in a cell with their LoginName.

This LoginName will be used as the filename to save the file automatically
in a SPECIFIC FOLDER.

This is what I'd like to achieve:

1. I have a Spreadsheet with 12 worksheets, January to December

2. The user enters his/her LoginName (JOHNDOE) in cell A1 in worksheet

January

3. When user click/use SAVE; they will be asked to fill the cell A1 in
worksheet January if they have left this cell empty by mistake

4. When user click/use SAVE; they will get a prompt message asking them to
confirm whether their LoginName (johndoe) in cell A1 is correct

5. If they choose YES; the file will be saved in folder C:\timesheet\ as
johndoe.xls

6. The user will receive another prompt to let them know that the file was
saved as C:\timesheet\johndoe.xls

7. If they choose NO; sub ends and the user repeats the process with

correct
LoginName

8. When user click/use SAVE AS (instead of using SAVE); they will be given
LoginName (johndoe) in the FILE NAME section of the SAVE AS prompt screen.

I have been working on this over a month and have tried everything I know.
I have also asked for help but owing to my limited knowledge - I'm back!

Please help and advice. Please be as detailed as you deem necessary - I'm

a
novice.

Many thanks in advance.




 
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
can an automated notification (on xls file changes) email can be anat_ny Excel Discussion (Misc queries) 1 July 10th 07 07:16 PM
Automated file name retrieval and updates Ginger Excel Worksheet Functions 4 September 7th 05 08:11 PM
how to disable save prompt on closing excel file in automated mode [email protected] Excel Discussion (Misc queries) 3 July 6th 05 10:35 PM
Automated saving - Please Help & Advice SU Excel Programming 2 March 1st 05 12:28 PM
Prompt message and Automated saving! SU Excel Programming 3 February 26th 05 12:58 AM


All times are GMT +1. The time now is 01:02 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"