Home |
Search |
Today's Posts |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
If you right click the wb.name and add a watch you can see what value is
being read. What I think is happening is the file specialone.xls has never been saved. Excel when a file has been create and not saved the name doesn't include the xls extension. Therefore you wer comparing "specilalone" with specialone.xls and not getting a match. This can be fixed by using the instr function. if instr(ucase(findname),ucase(wb.name)) 1 then You should determine why you have an unsaved workbook and determine if it is appropriate that the file wasn't saved before you make any changes. "Launchnet via OfficeKB.com" wrote: Good Morning Joel . . . I appreciate the help. The following is a copy of the code I used. Nothing Happens. Any Ideas ? When I step thru it, the "Const findname ="specialone.xls" is skipped over. When it gets to the If Found = True Then, it skips over the MsgBox and then finishes. Sub NewExcelWithWorkbookSpecialOne() Const findname = "specialone.XLS" Found = False For Each Wb In Workbooks If UCase(Wb.Name) = UCase(findname) Then Found = True Exit For End If Next Wb If Found = True Then MsgBox ("found file " & findname & " Do not open the file again") End If End Sub Thanks Matt@Launchnet Joel wrote: Try this Sub getworkbooks() Const findname = "BOOK1.XLS" Found = False For Each Wb In Workbooks If UCase(Wb.Name) = UCase(findname) Then Found = True Exit For End If Next Wb If Found = True Then MsgBox ("found file " & findname & " Do not open the file again") End If End Sub I have the following Macro that works, but I am trying to make it check to see if the workbook is already open . . . and if it is open, to give the [quoted text clipped - 65 lines] End Sub -- Please take a look at www.openoursite.com Click on: "Keywords" and then Click on "Matt's Story" and if you are a man, you should be very happy that you read my story. God Bless for everyones help. Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...mming/200708/1 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
when opening an Excel Workbook, another blank workbook also opens | Excel Discussion (Misc queries) | |||
when opening an Excel Workbook, another blank workbook also opens | Excel Discussion (Misc queries) | |||
excel VBA problem - setting workbook as variable & opening/re-opening | Excel Programming | |||
How to make the opening of a workbook conditional upon the opening of another workbook | Excel Programming | |||
How to make opening of workbook conditional of opening of another workbook | Excel Programming |