#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 37
Default Open Workbook error

Hi.
I need to open a Workbook that starts with "Reg" but the instruction I
created gives me an error (the wild card doesn't work):

Set wbReg = Workbooks.Open(ThisWorkbook.Path & "\Reg*.xls")

Any suggestions?
--
Alex
*Remember to click "yes" if this post helped you. Thank you!

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,520
Default Open Workbook error

Try

Dim strFile As String
strFile = Dir(ActiveWorkbook.Path & "\bond*.xl*", vbNormal)
Do While strFile < ""
Set wbReg = Workbooks.Open(ActiveWorkbook.Path & "\" & strFile)
Exit Do
Loop

If this post helps click Yes
---------------
Jacob Skaria


"alexrs2k" wrote:

Hi.
I need to open a Workbook that starts with "Reg" but the instruction I
created gives me an error (the wild card doesn't work):

Set wbReg = Workbooks.Open(ThisWorkbook.Path & "\Reg*.xls")

Any suggestions?
--
Alex
*Remember to click "yes" if this post helped you. Thank you!

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,520
Default Open Workbook error

This should do...

Dim strFile As String
strFile = Dir(ActiveWorkbook.Path & "\Reg*.xl*", vbNormal)
If strFile < "" Then
Set wbReg = Workbooks.Open(ActiveWorkbook.Path & "\" & strFile)
End If

If this post helps click Yes
---------------
Jacob Skaria


"Jacob Skaria" wrote:

Try

Dim strFile As String
strFile = Dir(ActiveWorkbook.Path & "\bond*.xl*", vbNormal)
Do While strFile < ""
Set wbReg = Workbooks.Open(ActiveWorkbook.Path & "\" & strFile)
Exit Do
Loop

If this post helps click Yes
---------------
Jacob Skaria


"alexrs2k" wrote:

Hi.
I need to open a Workbook that starts with "Reg" but the instruction I
created gives me an error (the wild card doesn't work):

Set wbReg = Workbooks.Open(ThisWorkbook.Path & "\Reg*.xls")

Any suggestions?
--
Alex
*Remember to click "yes" if this post helped you. Thank you!

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 37
Default Open Workbook error

Thank you Jacob! It works perfectly.
--
Alex
*Remember to click "yes" if this post helped you. Thank you!



"Jacob Skaria" wrote:

This should do...

Dim strFile As String
strFile = Dir(ActiveWorkbook.Path & "\Reg*.xl*", vbNormal)
If strFile < "" Then
Set wbReg = Workbooks.Open(ActiveWorkbook.Path & "\" & strFile)
End If

If this post helps click Yes
---------------
Jacob Skaria


"Jacob Skaria" wrote:

Try

Dim strFile As String
strFile = Dir(ActiveWorkbook.Path & "\bond*.xl*", vbNormal)
Do While strFile < ""
Set wbReg = Workbooks.Open(ActiveWorkbook.Path & "\" & strFile)
Exit Do
Loop

If this post helps click Yes
---------------
Jacob Skaria


"alexrs2k" wrote:

Hi.
I need to open a Workbook that starts with "Reg" but the instruction I
created gives me an error (the wild card doesn't work):

Set wbReg = Workbooks.Open(ThisWorkbook.Path & "\Reg*.xls")

Any suggestions?
--
Alex
*Remember to click "yes" if this post helped you. Thank you!

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Opening Excel, Book1 opens, remains open with other workbook open DanieB Excel Discussion (Misc queries) 0 September 3rd 09 08:23 AM
how do i open a data workbook when i open a timesheet workbook [email protected] uk Excel Discussion (Misc queries) 2 January 4th 09 04:50 PM
EXCEL:Can't open any file without error saying it's ALREADY open??? Crackles McFarly Excel Worksheet Functions 1 November 1st 07 02:22 AM
excel 2003 saved file will not open without a blank workbook open Bob Excel Discussion (Misc queries) 4 November 11th 06 04:24 PM
Search open sheets in workbook and insert into open sheet punx77 Excel Discussion (Misc queries) 0 March 6th 06 05:07 PM


All times are GMT +1. The time now is 03:15 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"