Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I made a button that auto names/saves a file. Problem is they are saving it
with blank cells and hence the file name isn't correct, lol. I would like it to not let them save it and pop up a message box, prior to the current MsgBox, if ComboBox1 is "Please Select" and/or "M54" is blank. This is what I have so far. Thanks for your programming skills (Ron has been a God send for getting me this far) ------------------------------------------------------------- Dim PathName As String Dim strdate As String Dim str As String PathName = "\\Colfs1\public\Operations\RVC-OPS\Fancharts" strdate = Format(Now, "mm-dd-yy") With Sheets("VVS Fanchart") str = strdate & " " & .ComboBox1.Value & " " & .Range("M54") End With MsgBox "Saving file to 'RVC-OPS\Fancharts' as:" & " " & str ActiveWorkbook.SaveAs (PathName & "\" & str) ------------------------------------------------------------------- |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi
Try this Shinka Dim PathName As String Dim strdate As String Dim str As String PathName = "\\Colfs1\public\Operations\RVC-OPS\Fancharts" strdate = Format(Now, "mm-dd-yy") With Sheets("VVS Fanchart") If .ComboBox1.Value = "Please Select" Or .Range("M54").Value = "" Then MsgBox "Please select a item in the combo or/and enter a value in M54" Else str = strdate & " " & .ComboBox1.Value & " " & .Range("M54") End With MsgBox "Saving file to 'RVC-OPS\Fancharts' as:" & " " & str ActiveWorkbook.SaveAs (PathName & "\" & str) End If -- Regards Ron de Bruin http://www.rondebruin.nl "Shinka" wrote in message ... I made a button that auto names/saves a file. Problem is they are saving it with blank cells and hence the file name isn't correct, lol. I would like it to not let them save it and pop up a message box, prior to the current MsgBox, if ComboBox1 is "Please Select" and/or "M54" is blank. This is what I have so far. Thanks for your programming skills (Ron has been a God send for getting me this far) ------------------------------------------------------------- Dim PathName As String Dim strdate As String Dim str As String PathName = "\\Colfs1\public\Operations\RVC-OPS\Fancharts" strdate = Format(Now, "mm-dd-yy") With Sheets("VVS Fanchart") str = strdate & " " & .ComboBox1.Value & " " & .Range("M54") End With MsgBox "Saving file to 'RVC-OPS\Fancharts' as:" & " " & str ActiveWorkbook.SaveAs (PathName & "\" & str) ------------------------------------------------------------------- |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Shinka
The End With Must be below the End If -- Regards Ron de Bruin http://www.rondebruin.nl "Ron de Bruin" wrote in message ... Hi Try this Shinka Dim PathName As String Dim strdate As String Dim str As String PathName = "\\Colfs1\public\Operations\RVC-OPS\Fancharts" strdate = Format(Now, "mm-dd-yy") With Sheets("VVS Fanchart") If .ComboBox1.Value = "Please Select" Or .Range("M54").Value = "" Then MsgBox "Please select a item in the combo or/and enter a value in M54" Else str = strdate & " " & .ComboBox1.Value & " " & .Range("M54") End With MsgBox "Saving file to 'RVC-OPS\Fancharts' as:" & " " & str ActiveWorkbook.SaveAs (PathName & "\" & str) End If -- Regards Ron de Bruin http://www.rondebruin.nl "Shinka" wrote in message ... I made a button that auto names/saves a file. Problem is they are saving it with blank cells and hence the file name isn't correct, lol. I would like it to not let them save it and pop up a message box, prior to the current MsgBox, if ComboBox1 is "Please Select" and/or "M54" is blank. This is what I have so far. Thanks for your programming skills (Ron has been a God send for getting me this far) ------------------------------------------------------------- Dim PathName As String Dim strdate As String Dim str As String PathName = "\\Colfs1\public\Operations\RVC-OPS\Fancharts" strdate = Format(Now, "mm-dd-yy") With Sheets("VVS Fanchart") str = strdate & " " & .ComboBox1.Value & " " & .Range("M54") End With MsgBox "Saving file to 'RVC-OPS\Fancharts' as:" & " " & str ActiveWorkbook.SaveAs (PathName & "\" & str) ------------------------------------------------------------------- |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Had to move End With after End If but it works.
Thanks so much Ron! "Ron de Bruin" wrote: Hi Try this Shinka Dim PathName As String Dim strdate As String Dim str As String PathName = "\\Colfs1\public\Operations\RVC-OPS\Fancharts" strdate = Format(Now, "mm-dd-yy") With Sheets("VVS Fanchart") If .ComboBox1.Value = "Please Select" Or .Range("M54").Value = "" Then MsgBox "Please select a item in the combo or/and enter a value in M54" Else str = strdate & " " & .ComboBox1.Value & " " & .Range("M54") End With MsgBox "Saving file to 'RVC-OPS\Fancharts' as:" & " " & str ActiveWorkbook.SaveAs (PathName & "\" & str) End If -- Regards Ron de Bruin http://www.rondebruin.nl "Shinka" wrote in message ... I made a button that auto names/saves a file. Problem is they are saving it with blank cells and hence the file name isn't correct, lol. I would like it to not let them save it and pop up a message box, prior to the current MsgBox, if ComboBox1 is "Please Select" and/or "M54" is blank. This is what I have so far. Thanks for your programming skills (Ron has been a God send for getting me this far) ------------------------------------------------------------- Dim PathName As String Dim strdate As String Dim str As String PathName = "\\Colfs1\public\Operations\RVC-OPS\Fancharts" strdate = Format(Now, "mm-dd-yy") With Sheets("VVS Fanchart") str = strdate & " " & .ComboBox1.Value & " " & .Range("M54") End With MsgBox "Saving file to 'RVC-OPS\Fancharts' as:" & " " & str ActiveWorkbook.SaveAs (PathName & "\" & str) ------------------------------------------------------------------- |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Auto file naming | Excel Discussion (Misc queries) | |||
Can I auto save to a separate file?(not the file I am working in) | Setting up and Configuration of Excel | |||
auto save excel file every 10 minutes to its original file name | Excel Discussion (Misc queries) | |||
Check File Name before Save Event | Excel Programming | |||
Check File Name before Save Event | Excel Programming |