Save as command - Help please

  • Thread starter Thread starter Steve
  • Start date Start date
S

Steve

Hi am wanting to use a userform with textbox1, whereby the user will
input a number (ie wk no 1-52) and this number will be saved to the C
drive with the following title

Wk plan + textbox.value.

Am still learning with VB code and not sure where to start with this

any help with code would be very appreciated


Many Thanks

Steve
 
Hi am wanting to use a userform with textbox1, whereby the user will
input a number (ie wk no 1-52) and this number will be saved to the C
drive with the following title

Wk plan + textbox.value.

Am still learning with VB code and not sure where to start with this

any help with code would be very appreciated

Many Thanks

Steve

Have managed to make the following work, but if anyone has anyway
better, would be appreciated :)



Private Sub Savenewfile_Click()

Const sPATH As String = "w:\plans 2011\"
If TextBox1.Value = "" Then
MsgBox "You need to enter a Week Number to save this file!!"
Else
If TextBox1.Value <> "" Then
ActiveWorkbook.SaveCopyAs sPATH & "New Plan Wk " & TextBox1.Value
& ".xls"
TextBox1.Value = ""
Unload Me
End If
End If

End Sub
 
Another question going forward

Is there a way to clear the contents of a page but only cells that are
unlocked,

rather than scrolling through and doing it manually?


Steve
 
I nibbled at it a little...
'---
Private Sub Savenewfile_Click()
Const sPATH As String = "w:\plans 2011\"
Dim strValue As String
strValue = Me.TextBox1.Value

If Len(strValue) = 0 Then
MsgBox "You need to enter a Week Number to save this file. ", _
vbExclamation, "Blame Steve"
ElseIf Val(strValue) < 1 Or Val(strValue) > 52 Then
MsgBox "A valid week number is between 1 and 52. ", _
vbExclamation, "Blame Steve"
Else
ActiveWorkbook.SaveCopyAs sPATH & "New Plan Wk " & Val(strValue) & ".xls"
Unload Me
End If
End Sub
--
Jim Cone
Portland, Oregon USA
http://www.mediafire.com/PrimitiveSoftware
(List Files: specific files/folders with hyperlinks)




"Steve" <[email protected]>
wrote in message
Hi am wanting to use a userform with textbox1, whereby the user will
input a number (ie wk no 1-52) and this number will be saved to the C
drive with the following title

Wk plan + textbox.value.

Am still learning with VB code and not sure where to start with this

any help with code would be very appreciated

Many Thanks

Steve

Have managed to make the following work, but if anyone has anyway
better, would be appreciated :)



Private Sub Savenewfile_Click()

Const sPATH As String = "w:\plans 2011\"
If TextBox1.Value = "" Then
MsgBox "You need to enter a Week Number to save this file!!"
Else
If TextBox1.Value <> "" Then
ActiveWorkbook.SaveCopyAs sPATH & "New Plan Wk " & TextBox1.Value
& ".xls"
TextBox1.Value = ""
Unload Me
End If
End If

End Sub
 
I nibbled at it a little...
'---
Private Sub Savenewfile_Click()
Const sPATH As String = "w:\plans 2011\"
Dim strValue As String
strValue = Me.TextBox1.Value

If Len(strValue) = 0 Then
   MsgBox "You need to enter a Week Number to save this file.   ", _
                  vbExclamation, "Blame Steve"
ElseIf Val(strValue) < 1 Or Val(strValue) > 52 Then
   MsgBox "A valid week number is between 1 and 52.   ", _
                  vbExclamation, "Blame Steve"
Else
   ActiveWorkbook.SaveCopyAs sPATH & "New Plan Wk " & Val(strValue) &".xls"
   Unload Me
End If
End Sub
--
Jim Cone
Portland, Oregon USAhttp://www.mediafire.com/PrimitiveSoftware
(List Files:  specific files/folders with hyperlinks)

"Steve" <[email protected]>
wrote in message






Have managed to make the following work, but if anyone has anyway
better, would be appreciated :)

Private Sub Savenewfile_Click()

    Const sPATH As String = "w:\plans 2011\"
    If TextBox1.Value = "" Then
    MsgBox "You need to enter a Week Number to save this file!!"
    Else
    If TextBox1.Value <> "" Then
    ActiveWorkbook.SaveCopyAs sPATH & "New Plan Wk " & TextBox1.Value
& ".xls"
    TextBox1.Value = ""
    Unload Me
    End If
    End If

End Sub

Thanks Jim for your assistance, always nice to see other ways to use
code to make things work, oh and thanks for the Blame too lol

:)
Steve
 
Back
Top