Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
DIR not working after first workbook opened.
I have this snippet of code
myFile = Dir(myFolder & "*.xls") Debug.Print myFile Do While myFile < "" On Error Resume Next Application.AutomationSecurity = msoAutomationSecurityLow Set oWB = Workbooks.Open(myFolder & myFile) Application.AutomationSecurity = msoAutomationSecurityByUI On Error GoTo 0 If Not oWB Is Nothing Then 'Do stuff application.displayalerts = false oWB.SaveAs myNewFolder & oWB.Name Application.DisplayAlerts = True oWB.Close End If myFile = Dir() '<~~~I get Run Time Error 5 here Loop I've done this before with no problem. What am I missing? FWIW, I've declared all variables. Thanks, Barb Reinhardt |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
formula not working when opened by another user | Excel Discussion (Misc queries) | |||
Opening a workbook if not opened, going to it if already opened | Excel Programming | |||
Opening a workbook if not opened, going to it if already opened | Excel Programming | |||
Opening a workbook if not opened, going to it if already opened | Excel Programming | |||
How to see if the opened workbook is opened by another user ? | Excel Programming |