View Single Post
 
Old 07-25-2018, 03:59 AM
Guessed's Avatar
Guessed Guessed is offline Windows 10 Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,176
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

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