Jwalker1973
New Member
- Joined
- Feb 21, 2022
- Messages
- 6
- Office Version
- 365
- Platform
- Windows
- Mobile
Hey all new registered user and I have an issue. I created some VBA code to check for a folder existence and create it if not. That part works great. Even got it to use one of my textbox values to so I could variablize the folder name. The problem is when it saves. It does not save to the folder and the filename is messed up.
Private Sub CommandButton1_Click
If Len(Dir("C:\Users\Jamie\Documents\Set Up Trend Data\ " & Sheet1.TextBox1.Value, vbDirectory )) = 0 Then
MkDir "C:\Users\Jamie\Documents\Set Up Trend Data\ " & Sheet1.TextBox1.Value
End If
That part works great.This issue is with the below.
Dim Filepath As String
Dim Filename As String
Filepath ="C:\Users\Jamie\Documents\Set Up Trend Data\ " & Sheet1.TextBox1.Value
Filename = Sheet1.TextBox2.Value
ActiveWorkbook.SaveCopyAs filename:= FileMaker & Filename & ".xls"
Any help would be appreciated. Sorry for the way post looksI am on my phone at work.
Private Sub CommandButton1_Click
If Len(Dir("C:\Users\Jamie\Documents\Set Up Trend Data\ " & Sheet1.TextBox1.Value, vbDirectory )) = 0 Then
MkDir "C:\Users\Jamie\Documents\Set Up Trend Data\ " & Sheet1.TextBox1.Value
End If
That part works great.This issue is with the below.
Dim Filepath As String
Dim Filename As String
Filepath ="C:\Users\Jamie\Documents\Set Up Trend Data\ " & Sheet1.TextBox1.Value
Filename = Sheet1.TextBox2.Value
ActiveWorkbook.SaveCopyAs filename:= FileMaker & Filename & ".xls"
Any help would be appreciated. Sorry for the way post looksI am on my phone at work.