From: Don Guillett on
Workbook name is not matching? Leading/trailing space/no space/??
If desired, send your file to my address below. I will only look if:
1. You send a copy of this message on an inserted sheet
2. You give me the newsgroup and the subject line
3. You send a clear explanation of what you want
4. You send before/after examples and expected results.


--
Don Guillett
Microsoft MVP Excel
SalesAid Software
dguillett(a)gmail.com
"Jock" <Jock(a)discussions.microsoft.com> wrote in message
news:33A2126E-369F-4CE9-8D93-EF31B14E097F(a)microsoft.com...
> Guys. Regardless of what I do, when the second Wb is closed, I get run
> time
> errors in:
> Set wb = Workbooks(strWorkbook) (Jacob), and
> Windows(workbookname & ".xls").Activate (Don)
>
> When Wb is open, both work fine!
> Thanks though.
> --
> Traa Dy Liooar
>
> Jock
>
>
> "Don Guillett" wrote:
>
>> This should activate if open or open if closed
>>
>> Sub GetWorkbook()
>> workbookname = "wb2"
>> On Error GoTo OpenWorkbook
>> Windows(workbookname & ".xls").Activate
>> Exit Sub
>> OpenWorkbook:
>> Workbooks.Open(workbookname & ".xls").RunAutoMacros xlAutoOpen
>> End Sub
>>
>> --
>> Don Guillett
>> Microsoft MVP Excel
>> SalesAid Software
>> dguillett(a)gmail.com
>> "Jock" <Jock(a)discussions.microsoft.com> wrote in message
>> news:32A0350B-A88A-4E36-8770-DB6CA7277BD6(a)microsoft.com...
>> > Wb1, Sht2 has data in cols A-D. This data is copied to this location by
>> > code
>> > daily when new cases are started on sht1 in the same Wb.
>> > Once a week, I need the data from Sht2 to be copied to WB2, Sht3 by
>> > clicking
>> > a button. Once data copied over to Wb2, Sht 3, the data on Wb1, Sht 2
>> > to
>> > be
>> > deleted.
>> > The problem I am having is checking to see if Wb2 is open - I get the
>> > 'subscript out of range' error.
>> > How do I check if a workbook is open (without getting a debug window),
>> > open
>> > it if it is closed and show a message to that effect?
>> > --
>> > Traa Dy Liooar
>> >
>> > Jock
>>
>> .
>>