I could not find this in the help file, so here goes...
I have some code that opens a word doc which is then set to a variable
called Target. Then a FollowHyperlink opens another word doc that is set to
a variable called Source. The "Source" data is copied and pasted to
"Target" and then "Source" is closed.
This runs in a loop and gets the contents of several word docs copied into
one place. But my code is very simple and relies on all files being
present - if a word doc is missing, then the Target is set as Source and
things do not go well.
For iCtr = 1 To UBound(FundPerfArray)
link = PathMod.FirstPath & "Company Folders\" &
FundPerfArray(iCtr).strTicker & "_" & FundPerfArray(iCtr).strFund_Name &
".Doc"
FollowHyperlink (link) ' this works if the file is present, but
what if it is not
Set oWordDocSource = oWord.ActiveDocument
oWordDocSource.Activate
oWordDocSource.Bookmarks(1).Select
oWord.Selection.WholeStory
oWord.Selection.Copy
oWordDocTarget.Activate
oWord.Selection.Paste
oWordDocSource.Close
Set oWordDocSource = Nothing
Next iCtr
What can I do to test if the FollowHyperlink(link) is successful? I assume
that if the test failed the resolution would be "Exit For" ?
Thanks