Manage Word Session

Posted on 2005-05-10
Last Modified: 2013-12-03

I am working with a visual basic 6 application that open in a new word session width a document that i write...

This session is invisible..
The problem is: When an user open a new word document by doubleclick word use my session to open this... And closing this session, my application give me an error because server word does not exist...

It is possible lock my session only for me ???


Question by:kaiou
    LVL 4

    Expert Comment

    Can you show some code on how you are creating the Word object and how you are closing it?
    LVL 2

    Accepted Solution


    The error is because your program is trying to write by mistyke to the new document that had been opened...
    Do you trying to write:
    ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
    ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument

    Most likely this is the problem....


    Author Comment

    That is the code i use to open , close word session, and open a document:

    in a class module (clsWD) i initialize application object

    Public WithEvents wd As Word.Application

    Private Sub Class_Initialize()
    Set wd = New Word.Application
    End Sub

    Private Sub Class_Terminate()
    wd.quit 0
    Set wd=nothing
    End Sub

    When it is necessary i declare and initialize class.

    dim objWD as clsWD

    and unload with set objWD=nothing

    Excuse me, but the problem is caused by user, that close the session word that i use, because it is not invisible.

    I want open a word document with a new word session and not an already opened.

    Featured Post

    Threat Intelligence Starter Resources

    Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

    Join & Write a Comment

    Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
    This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
    As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
    Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now