Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Ce works in debugger but will not return from call outside debugger

Status
Not open for further replies.

aMember

Programmer
Jun 12, 2002
99
US
The DoWBUpdate routine is called from a command button on
a sheet.

When I step through the code in the debugger...all works
fine. When I just let the code execute, it never returns
from the OpenFiles call. Specifically...I have put msgbox
surrounding the workbook.open and when I just let the code
run, it does not return.

Yes, the WB I am opening does have a workbook.open event.
However, I have executed this code hundreds of times with
problems as I open and close this WB several times a day. And, when I step through this WB.open code, it works
fine.

sub DoWBUpdate()

dim WBtoUpdate as string
Dim theFile As Workbook
Dim theTemplate As Workbook

WBtoUpdate =frmOpenWorkbooks.lstOpenWorkbooks.Value
Application.DisplayAlerts = True

OpenFiles "Escapes.xls", WBToUpdate, TempEscapes

Set theFile = Workbooks(WBtoUpdate)

{rest removed}

end sub

Sub OpenFiles(TempType As String, theFile As String,
theTemp As String)

Dim Destination As String

Destination = Workbooks(theFile).Path & "\" & theTemp
Template = PathToTempType & TemplateType

If TempFileExists(Destination) Then
Kill Destination
End If
' copy a new template file into working directory
FileCopy Template, Destination
On Error GoTo 0
Workbooks.Open Destination, updateLinks:=False

end sub
.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top