P
pthomasberkeley
Hello-
I am getting intermittant "error91" messages with this code which operates a
macro to open a 2 separate files, copy all text contents, close and then
paste into the active document.
Sub Macro01040and1050()
ChangeFileOpenDirectory "P:\Spec\"
Documents.Open FileName:="01040.doc", ConfirmConversions:=False,
ReadOnly _
:=False, AddToRecentFiles:=False, Revert:=False, _
Format:=wdOpenFormatAuto
Selection.Copy
ActiveWindow.Close
Selection.Paste
Documents.Open FileName:="01050.doc", ConfirmConversions:=False,
ReadOnly _
:=False, AddToRecentFiles:=False, Revert:=False, _
Format:=wdOpenFormatAuto
Selection.WholeStory
Selection.Copy
ActiveWindow.Close
Selection.Paste
End Sub
I am new to VBA and cannot figure out what is wrong with this code, that
would cause the macro to run most of the time but fail about 20%. Any
thoughts or solutions are appreciated...
I am getting intermittant "error91" messages with this code which operates a
macro to open a 2 separate files, copy all text contents, close and then
paste into the active document.
Sub Macro01040and1050()
ChangeFileOpenDirectory "P:\Spec\"
Documents.Open FileName:="01040.doc", ConfirmConversions:=False,
ReadOnly _
:=False, AddToRecentFiles:=False, Revert:=False, _
Format:=wdOpenFormatAuto
Selection.Copy
ActiveWindow.Close
Selection.Paste
Documents.Open FileName:="01050.doc", ConfirmConversions:=False,
ReadOnly _
:=False, AddToRecentFiles:=False, Revert:=False, _
Format:=wdOpenFormatAuto
Selection.WholeStory
Selection.Copy
ActiveWindow.Close
Selection.Paste
End Sub
I am new to VBA and cannot figure out what is wrong with this code, that
would cause the macro to run most of the time but fail about 20%. Any
thoughts or solutions are appreciated...