View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Mark Dullingham Mark Dullingham is offline
external usenet poster
 
Posts: 92
Default Using a TextBox value in a file String

I have the following code ina standard module, the user can enter there own
file name via a form.

Sub The_SubSave()
Dim fName As String
fName = frmOptions.TextBox1.Value
If frmOptions.CheckBox2.Value = False Then
ActiveWorkbook.SaveCopyAs "C:\AutoSaves" & "fName" _
& "." & Format(Date, "dd-mmm-yyyy") & "." & Format(Time, "hh-mm-ss") &
".xls"
Else
ActiveWorkbook.SaveCopyAs "C:\AutoSaves\DDE Sheet" _
& "." & Format(Date, "dd-mmm-yyyy") & "." & Format(Time, "hh-mm-ss") &
".xls"
End If
StartTimer

End Sub

The problem is if the checkbox is false the first if statement which include
the textbox value as part if the file path does'nt work.

Ive trie placing in( ) and " " of having the tectbox in the string but it
does not wok!
The Else option works fine!
Does anyone have any suggestions

Thanks in advance for any help