Chrissyb173
New Member
- Joined
- Jul 21, 2015
- Messages
- 3
Hello there!
I am hoping someone could help me!
I am trying to save a worksheet as a text file which i know is definitely possible and has been achieved by many other people but for some reason it is not working for me.
Could someone take a look at my code and let me know where i have gone wrong please?
The error occurs at the SaveAs line.
The 'Me.FolderLocation.Value' object is one that the user selects themselves in a previous step so i know for certain the the file path works and i have even quality checked this by adding a Msgbox with the full file path.
I am hoping someone could help me!
I am trying to save a worksheet as a text file which i know is definitely possible and has been achieved by many other people but for some reason it is not working for me.
Could someone take a look at my code and let me know where i have gone wrong please?
The error occurs at the SaveAs line.
The 'Me.FolderLocation.Value' object is one that the user selects themselves in a previous step so i know for certain the the file path works and i have even quality checked this by adding a Msgbox with the full file path.
Code:
Private Sub ButtonExportLog_Click()
Dim FName As String
FName = "Timesheet Upload Log Extract " & Format(Now, "DD-MMM-YY HH-MM") & ".txt"
Workbooks.Add
ActiveSheet.Cells(1, 1) = Me.TextBox.Value
ActiveSheet.SaveAs FileName:=Me.FolderLocation.Value & FName, FileFormat:=xlText
ActiveWorkbook.Close (False)
End Sub