Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
VBA - Testing for Book1, Book2 etc.
Every day Quickbooks will create an excel file and depending on what is going
on on the user's system, it may be created as Book1, Book2 etc. In another file on the user's machine, I'd like to create a macro that will save that file to the network with a specific name. So I need a way of testing if there is an open workbook called Book1, Book2 etc. There will only be one Bookx file so if I find anything Bookx that's the one I need. Thanks for any help on this. |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
VBA - Testing for Book1, Book2 etc.
Paste the below function in your code and use it as
If Checkforworkbook ("Book25.xls") = True Then 'do something End If Function CheckforWorkbook(strSearch As String) As Boolean Dim intTemp For intTemp = 1 To Workbooks.Count If InStr(1, Workbooks(intTemp).Name, strSearch, 1) < 0 Then CheckforWorkbook = True: Exit Function End If Next End Function -- If this post helps click Yes --------------- Jacob Skaria "dhstein" wrote: Every day Quickbooks will create an excel file and depending on what is going on on the user's system, it may be created as Book1, Book2 etc. In another file on the user's machine, I'd like to create a macro that will save that file to the network with a specific name. So I need a way of testing if there is an open workbook called Book1, Book2 etc. There will only be one Bookx file so if I find anything Bookx that's the one I need. Thanks for any help on this. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Transfer info book1 to book2 | New Users to Excel | |||
Can I make a formula that always uses the latest wksht in Book2? | Excel Worksheet Functions | |||
Book1 and Book2 | Excel Discussion (Misc queries) | |||
=SUMIF(book2!L3:AF3, "=book1!O30", book2!L20:AF20) | Excel Discussion (Misc queries) | |||
opens to Book2 | Excel Discussion (Misc queries) |