Hi! Plz Help ME...

Shariq.khan

New Member
Joined
Jun 16, 2011
Messages
5
HI! Im Having a problem with this code. I wanna create a new Excel WOrkBook. But I've a problem In the solution Given below:

Sub Test()
x = InputBox("Enter WOrkbook Name")


Dim strDir As String
'// Please Note ""
strDir = "E:Check"
With Application.FileSearch
.LookIn = strDir
.FileName = x
.FileType = msoFileTypeAllFiles

If .Execute() > 0 Then
'// Please Note ""
Workbooks.Open (strDir & "" & x)
Exit Sub
Else
'// Please Note ""
Workbooks.Add.SaveAs (strDir & "" & x )
ActiveWorkbook.Close
End If
End With

End Sub
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
Code:
strDir = "E:[B][COLOR="Red"]\[/COLOR][/B]Check"
 
Upvote 0
Welcome to the forum.

If you are using an inputbox to create a workbook, in the code you are using you are not refering to ".xls" as an extension. You are also missing the E:\ (Slash)

The code is also looking at using FileSearch which has been removed in 2007, so one question is are you using 2007 or 2003 or below?
 
Upvote 0
Thanx,
but
I've an error on this location of code i.e. Object Required
on the statement:
With Application.FileSearch
 
Upvote 0

Forum statistics

Threads
1,224,564
Messages
6,179,548
Members
452,927
Latest member
rows and columns

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