LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
SU SU is offline
external usenet poster
 
Posts: 25
Default Automated saving - Please Help & Advice

I am using the following code to save a file using a value in a cell.

Please help and provide detailed answer as I am new with VB.

This is what I want to achieve:

1) If cell is empty, prompt the user to enter their LoginName
2) Even if the cell is filled, ask the user if that is the correct LoginName
- perhaps by showing the LoginName, but I don't know how to do this!
3) save the file using value in a cell - I would like to save it to a
specific folder, but again don't know how to.

The problems I'm having a

1) I am getting the message and prompt "Have you entered correct LoginName?"
twice
2) Something is wrong with this part of the code: ActiveWorkbook.SaveAs
Sheets("Jan").Range("Y23").Value & ".xls"
3) When the Excel Prompt comes with "File already exists do you want to
replace it" and the user clicks no another prompt says "visual basic error
400"

Please help and provide detailed answer as I am new with VB.

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Dim Msg, Style, Title, Help, Ctxt, Response, MyString
If Me.Sheets(1).Range("$T$23").Value = "" Then
Beep
MsgBox "You have not entered your LoginName on the first sheet - Jan!"
Let Cancel = True
Exit Sub
End If
Msg = "Have you entered correct LoginName?"
Style = vbYesNo
Title = "Save Prompt"
Response = MsgBox(Msg, Style, Title)
If Response = vbYes Then
ActiveWorkbook.SaveAs Sheets("Jan").Range("Y23").Value & ".xls"
Exit Sub
Else
Cancel = True
End If
End Sub
 
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
pls advice dribler2 Excel Worksheet Functions 0 December 29th 06 02:22 PM
Advice Please Greg B Excel Worksheet Functions 5 March 17th 05 12:13 PM
Almost got it !! but need advice Nospam Excel Worksheet Functions 6 February 28th 05 10:27 AM
Prompt message and Automated saving! SU Excel Programming 3 February 26th 05 12:58 AM
RTD Advice JD Excel Programming 2 October 22nd 04 11:29 AM


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