Re: word vba error <automation error> by Jezebel
Jezebel
Tue May 03 17:38:35 CDT 2005
Presumably there are more things going on between the Open and Save
instructions. Excel will throw an error on Save if there were any unresolved
errors during processing along the way.
The previous times I've met the problem, in my own and in other people's
code, it was to do with the Range keyword. If you copied some code from
Excel VBA to Word VBA, you might have a Sort instruction along the lines of
With objwkb.sheets(1).rows("3:5)
.Sort Key1:=Range("A6"), Order1:=....
end with
The error is the missing period in front of "Range". Excel doesn't report
this as an error; it just sulks silently and throws a tantrum later on.
"VBALover" <Vbalover@noemail.com> wrote in message
news:%23%23lKaL$TFHA.3584@TK2MSFTNGP14.phx.gbl...
> Hi All,
>
> Here is the code:
>
> Set objXL = New Excel.Application
> Set objwkb = objXL.Workbooks.Open(datafile)
>
> objwkb.Save '<--- Error in this code
>
> If I get this error, I only need to close the Word and re-open again. Then
> there will be no error.
>
> The error not happen all the time. It may happens after I copy the excel
> to
> the same directory.
>
>
> Thanks for advice.
>
>
> Regards
>
>
>
>