Every once in a while, under completely arbitrary circumstances, a document will cause this error--and it will keep causing it over and over again unless you recreate the document.
-David
Every once in a while, under completely arbitrary circumstances, a document will cause this error--and it will keep causing it over and over again unless you recreate the document.
-David
Ok that's great cause this means you will be able to debug it! If you step through your code (F8) you can see at what line the error occurs. (Then debug some more to what the value of the causing variable is.)Originally Posted by wadiohead
So we can test all sort of stuff when the document is in that state so that's a good thing.
If it where at random it would be harder.
_________
Groetjes,
Joost Verdaasdonk
M.O.S. Master
Mark your thread solved, when it has been, by hitting the Thread Tools dropdown at the top of the thread.
(I don't answer questions asked through E-mail or PM's)
Finally someone got the error!
The bad file name error is triggered twice; once on the first (non error-trapped) line of
[VBA]
WorkingDoc.SaveAs filename, wdFormatHTML
[/VBA]
the other time on:
[VBA]
Set WorkingDoc = Application.Documents(filename)
[/VBA]
The problem, it seems, is that the filename is equal to ?\1_0.htm?.
Filename's value is set by the earlier:
[VBA]filename = entDir & "\" & etype & "_" & eid & ".htm"[/VBA]
And, of course, entDir (which is located in a variable that is supposed to be in the active document) is blank. EntDir is set to ""%userprofile%\Locals~1\Temp\Contex\1_0" when an error doesn't occur.
Several other of their values seem to be blank as well. I don't know if this affects anything or not.
Contexdir = ??
This is set to "%userprofile%\Locals~1\Temp\Contex" when the error doesn't occur.
Username =??
this variable doesn't seem to exist in any documents. Sloppy.
Password =??
This variable also doesn't seem to exist in any documents. Sloppy.
But, I'm going to cross my fingers and hope that adding the entDir variable to the open document will fix the problem.
This seems like excellent progress to me!
Very good to here you found your sollution.
Btw you can always go back and hardcoding the path like in the old template!
See you in the next challenge!
_________
Groetjes,
Joost Verdaasdonk
M.O.S. Master
Mark your thread solved, when it has been, by hitting the Thread Tools dropdown at the top of the thread.
(I don't answer questions asked through E-mail or PM's)