Hello, gurus.
A quick question having to do with semantics as much as anything else.
I have a routine that occasionally and inexplicably throws a "File not found" error when performing a mail merge. When this occurs, the debug button opens the VBA studio and I hit 'F5' and it takes off again as if the error never happened. It's not on the same template every time, nor is the pattern anything but random, and the files in question do exist because their names are retrieved from existing folders earlier in the program.
Anyway, I'd like to bracket the offending command in "On Error Resume Next" and "On Error GoTo 0" so that in my absence my staff can run the program and not have to contend with this randomness. However, everything I read says that "On Error Resume Next" "ignores the error and resumes execution on the next line of code."
I'd like execution to resume on the offending command itself, since there never seems to be an actual error when handled manually. Am I simply reading the explanation incorrectly, or should I approach the situation differently?
Thanks.
Just in case, the command in question is displayed below. All standard Dims and Sets are present.
A quick question having to do with semantics as much as anything else.
I have a routine that occasionally and inexplicably throws a "File not found" error when performing a mail merge. When this occurs, the debug button opens the VBA studio and I hit 'F5' and it takes off again as if the error never happened. It's not on the same template every time, nor is the pattern anything but random, and the files in question do exist because their names are retrieved from existing folders earlier in the program.
Anyway, I'd like to bracket the offending command in "On Error Resume Next" and "On Error GoTo 0" so that in my absence my staff can run the program and not have to contend with this randomness. However, everything I read says that "On Error Resume Next" "ignores the error and resumes execution on the next line of code."
I'd like execution to resume on the offending command itself, since there never seems to be an actual error when handled manually. Am I simply reading the explanation incorrectly, or should I approach the situation differently?
Thanks.
Just in case, the command in question is displayed below. All standard Dims and Sets are present.
Code:
AppWd.ActiveDocument.MailMerge.OpenDataSource Name:= _
"G:\Huge\Big\Medium\Specific\DocMaker.xlsm" _
, ConfirmConversions:=False, ReadOnly:=False, LinkToSource:=True, _
AddToRecentFiles:=False, PasswordDocument:="", PasswordTemplate:="", _
WritePasswordDocument:="", WritePasswordTemplate:="", Revert:=False, _
Format:=wdOpenFormatAuto, Connection:= _
"Provider=Microsoft.Jet.OLEDB.4.0;Password="""";User ID=Admin;Data Source=G:\Huge\Big\Medium\Specific\DocMaker.xlsm;Mode=Read;Extended Properties=""HDR=YES;IMEX=1;"";Jet OLEDB:System database="""";Jet OLEDB:Registry Path="""";Je" _
, SQLStatement:="SELECT * FROM `DataSet$`", SQLStatement1:="", SubType:= _
wdMergeSubTypeAccess