![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: Feb 2002
Location: Stockton, California
Posts: 281
|
Hi everyone, another question. I found this function posted by Juan, but Im having trouble using it. here is my macro:
sub test() 'other macro stuff here 'Open Workbooks.Open Filename:= _ "S:FileServerShared FilesUnsecuredUnsecured Contract Selector.xls", ReadOnly:=True wait5: Application.Wait (Now + TimeValue("0:00:05")) If WBisOpen("Unsecured Contract Selector") = True Then GoTo wait5 Else MsgBox ("pasting info") End If End Sub Function WBisOpen(Bk As String) As Boolean Dim T As Workbook Err.Clear On Error Resume Next Set T = Workbooks(Bk) WBisOpen = Not (Err.Number > 0) Err.Clear On Error GoTo 0 End Function It seems like when the other workbook opens, it stops the macro which checks to see if its open? i never get the msgbox! help! Thanks [ This Message was edited by: robfo0 on 2002-04-15 15:35 ] |
|
|
|
|
|
#2 |
|
Board Regular
Join Date: Mar 2002
Location: Cincinnati, Ohio, USA
Posts: 6,824
|
Hi
I could be wrong, but change this and re-try: wait5: Application.Wait (Now + TimeValue("0:00:05")) WBisOpen "Unsecured Contract Selector" If WBisOpen Then GoTo wait5 MsgBox ("pasting info") Tom |
|
|
|
|
|
#3 |
|
Board Regular
Join Date: Feb 2002
Location: Stockton, California
Posts: 281
|
I tried your code, and added another message to see if the code was running.
when i execute the macro, the new workbook opens (the workbook being opened executes a userform upon opening), but neither of the message boxes come up. Does the code freeze when a userform opens?? Here is the code i tried: wait5: MsgBox ("waiting5") Application.Wait (Now + TimeValue("0:00:05")) WBisOpen "Unsecured Contract Selector" If WBisOpen("Unsecured Contract Selector") Then GoTo wait5 MsgBox ("pasting info") help! thanks |
|
|
|
|
|
#4 |
|
Board Regular
Join Date: Mar 2002
Location: Cincinnati, Ohio, USA
Posts: 6,824
|
Yes.
A userform is usually modal, always in 97. Modal means aint nothin happening until you close the userform. Tom |
|
|
|
|
|
#5 |
|
Board Regular
Join Date: Feb 2002
Location: Stockton, California
Posts: 281
|
well...even when im finished with the userform and it closes...the macro does NOT continue...with the code above, i should always get a message right? but when i run the macro, the sheet opens, i do the userform stuff, i get NO messages at all
|
|
|
|
|
|
#6 |
|
Board Regular
Join Date: Feb 2002
Location: Stockton, California
Posts: 281
|
wellp...i havnet done this up until now, but i'd really appreciate any ideas on this problem
My code seems to stop when i open another file (which runs a user form on open)!! help! |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|