Help ~ SaveAs Active Workbook Path & Textbox1.Text

jonathann3891

Board Regular
Joined
Apr 27, 2015
Messages
109
How can I make this work?

When debugging, its showings all the correct information, but gives me an this error;
"Invalid procedure call or argument"

Code:
With UserForm1sFileName = ActiveWorkbook.Path & "\" & Left(UserForm1.TextBox1.Text, InStr(1, UserForm1.TextBox1.Text, ".") - 1) & ".csv"
End With

Thanks,
Jonathan
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
Does the value in textbox1 contain a . when you get the error?
 
Upvote 0
That's your problem then, as this part
Code:
InStr(1, UserForm1.TextBox1.Text, ".")
is looking for a .
What sort of value will textbox1 hold?
 
Upvote 0
In that case try
Code:
   With UserForm1
      sfilename = ActiveWorkbook.Path & "\" & .TextBox1.Text & ".csv"
   End With
 
Upvote 0
Like this
In the userform module
Code:
Private Sub CommandButton1_Click()
   Call Chk(TextBox1.Text)
End Sub
And then in a normal module
Code:
Sub Chk(Txt As String)
   MsgBox Txt
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top