Check if Workbook is open with dynamic name

Blunder1

Active Member
Joined
Jun 2, 2010
Messages
250
Hi,

I need to check if a workbook is already open and am struggling with the correct code. I think i'm almost there, see below, however it comes up with an error when trying to set the workbook.

Code:
Sub Raw_Data()
Dim Iptbox As Excel.Range
Dim wbook As Workbook
Set Iptbox = Application.InputBox(Prompt:="Highlight cell to open raw data", Title:="Date for Raw Data", Type:=8)
Range("iv1").Formula = CDate(Iptbox)

Set wbook = Workbooks("Fail stats COB" & Format(Iptbox, "mmdd") & ".xls")
If Not wbook Is Nothing Then
Workbooks.Open Filename:= _
       "V:\Daily Raw Data\" & Format(Range("iv1").Value, "yyyy""\""mmmm""\Wipro Fail stats COB ""ddmm"), IgnoreReadOnlyRecommended:=True
End If
 
End Sub

Any helo will be much appreciated.

Thanks in advance

Blunder
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
the full name will depend on the date.....

Well......that much I gathered. An example?

Please note Andrew's direction, I would include an On Error GoTo 0 immedietely after the Set.
 
Upvote 0
but when the user selects a date i need to open that specific workbook. Before that i need ot check if it is already open. To set the work book name i need the static part 'Fail stats COB' followed by the date which will be stored in the cell 'iv1'. This is what i cannot seem to set wothout an error...
 
Upvote 0

Forum statistics

Threads
1,224,578
Messages
6,179,654
Members
452,934
Latest member
mm1t1

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