Consulting

Page 2 of 2 FirstFirst 1 2
Results 21 to 24 of 24

Thread: Pickle of a problem: Autoopen and 4160 Bad File Name

  1. #21
    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

  2. #22
    Administrator
    VP-Knowledge Base
    VBAX Guru MOS MASTER's Avatar
    Joined
    Apr 2005
    Location
    Breda, The Netherlands
    Posts
    3,281
    Location
    Quote Originally Posted by wadiohead
    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.)

    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)

  3. #23
    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.






  4. #24
    Administrator
    VP-Knowledge Base
    VBAX Guru MOS MASTER's Avatar
    Joined
    Apr 2005
    Location
    Breda, The Netherlands
    Posts
    3,281
    Location
    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)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •