bassnsjp
06-12-2009, 01:11 PM
Using MS Office 2003 and Windows XP PRO
Have a scenario that is quite puzzling, in that when I'm opening a particular file the macro just stops. However, if I set a break on the open statement and then do nothing other than hit F5 to continue processing the macro completes as intended and generates desired results. By the way, the file does open, but all processing stops. If I set a break on the following IF Err.Number statement processing never reaches it. Any ideas anyone, thanks in advance for your efforts. I use the exact same process in opening several other files with no problems. ???? :banghead: :help
I don't have connectivity to the PC that has the code so I have to type in a short example.
sub Main()
call openallfiles
end sub
sub openallfiles
dim runpthname as string
dim invwkbname as string
runpthname = "c:\computername\myname\subdirectory\anotherdirectory\"
invwkbname = "Inventory.xls"
' If I set a break here and hit F5 the macro completes
workbooks.open filename:= runpthname & invwkbname
' If I set a break here it never reaches it?????
if err.number <> 0 then
msgbox ("Error occurred in opening file: " & invwkbname)
end if
end sub
Have a scenario that is quite puzzling, in that when I'm opening a particular file the macro just stops. However, if I set a break on the open statement and then do nothing other than hit F5 to continue processing the macro completes as intended and generates desired results. By the way, the file does open, but all processing stops. If I set a break on the following IF Err.Number statement processing never reaches it. Any ideas anyone, thanks in advance for your efforts. I use the exact same process in opening several other files with no problems. ???? :banghead: :help
I don't have connectivity to the PC that has the code so I have to type in a short example.
sub Main()
call openallfiles
end sub
sub openallfiles
dim runpthname as string
dim invwkbname as string
runpthname = "c:\computername\myname\subdirectory\anotherdirectory\"
invwkbname = "Inventory.xls"
' If I set a break here and hit F5 the macro completes
workbooks.open filename:= runpthname & invwkbname
' If I set a break here it never reaches it?????
if err.number <> 0 then
msgbox ("Error occurred in opening file: " & invwkbname)
end if
end sub