Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. closing the word doc

closing the word doc

Scheduled Pinned Locked Moved Visual Basic
question
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    jishbalan
    wrote on last edited by
    #1

    Hello, i am creating my report table in word doc using VBA. When my application hangs and trying to open the word doc again, it says, document is locked by user or some time popup comes asking want to open as ready only. How can i close the word doc before opening it again. Thanks and regards Jishith

    K D 2 Replies Last reply
    0
    • J jishbalan

      Hello, i am creating my report table in word doc using VBA. When my application hangs and trying to open the word doc again, it says, document is locked by user or some time popup comes asking want to open as ready only. How can i close the word doc before opening it again. Thanks and regards Jishith

      K Offline
      K Offline
      kvelu d
      wrote on last edited by
      #2

      write the below code in closing event wrdDoc.Close(False) wrdDoc = Nothing wrdApp = Nothing or kill the application from the process

      1 Reply Last reply
      0
      • J jishbalan

        Hello, i am creating my report table in word doc using VBA. When my application hangs and trying to open the word doc again, it says, document is locked by user or some time popup comes asking want to open as ready only. How can i close the word doc before opening it again. Thanks and regards Jishith

        D Offline
        D Offline
        Dave Kreskowiak
        wrote on last edited by
        #3

        jishbalan wrote:

        When my application hangs

        If your application hangs, you don't get the opportunity to close the file properly. That's why you can't open it on the next run. The system still thinks you have the file open. Your code cannot correct this situation, unless you manage to stop hanging in the first place.

        A guide to posting questions on CodeProject[^]
        Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
             2006, 2007, 2008

        J 1 Reply Last reply
        0
        • D Dave Kreskowiak

          jishbalan wrote:

          When my application hangs

          If your application hangs, you don't get the opportunity to close the file properly. That's why you can't open it on the next run. The system still thinks you have the file open. Your code cannot correct this situation, unless you manage to stop hanging in the first place.

          A guide to posting questions on CodeProject[^]
          Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
               2006, 2007, 2008

          J Offline
          J Offline
          jishbalan
          wrote on last edited by
          #4

          Thanks for the reply.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups