When the code fails, what is the value of StrWkBkNm?
StrWkBkNm = ThisDocument.Path & "\dados.xlsx"
ThisDocument.Path would fail in two potential ways:
- Document hasn't been saved therefore it has no path
- Code is in a template and not in the document itself. If that is the case, ThisDocument.Path would return the template path, not the document path.
Step through the code one line at a time and keep an eye on the variables that are assigned values as you go. If you see something unexpected, investigate what the reason is for that.
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
|