how to resolve a problem in excel when it opens

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • chandru8
    New Member
    • Sep 2007
    • 145

    how to resolve a problem in excel when it opens

    Hi to all

    I had a problem in excel file..,

    I am generating a new excel file through vb6.0 and i can access data from that excel.

    if user opens another excel file and closes my excel file also closed how to resolve this problem.

    can any one help me on this

    thank you for all in advance.
  • kadghar
    Recognized Expert Top Contributor
    • Apr 2007
    • 1302

    #2
    Originally posted by chandru8
    Hi to all

    I had a problem in excel file..,

    I am generating a new excel file through vb6.0 and i can access data from that excel.

    if user opens another excel file and closes my excel file also closed how to resolve this problem.

    can any one help me on this

    thank you for all in advance.
    open your excel file in a new object (excel application) and set its visible=false. this way, user wont be able to close it.

    Comment

    • prakashsakthivel
      New Member
      • Oct 2007
      • 57

      #3
      Originally posted by kadghar
      open your excel file in a new object (excel application) and set its visible=false. this way, user wont be able to close it.

      Hi,

      We have to use API function when we handle multiple instance of excel application. If you don't have any idea about this I will post code.


      musai.

      Comment

      • kadghar
        Recognized Expert Top Contributor
        • Apr 2007
        • 1302

        #4
        Originally posted by prakashsakthive l
        Hi,

        We have to use API function when we handle multiple instance of excel application. If you don't have any idea about this I will post code.


        musai.
        Dear sir,

        As long as i understood chandru's question, he should be using something like this to open an Excel's instance, and using its data:

        [CODE=vb]dim Obj1 as object
        set obj1 = createobject("e xcel.applicatio n")
        obj1.visible = true
        obj1.workbooks. open ("c:\myBook.xls ")
        msgbox obj1.cells(1,1)[/CODE]

        (that might have something to do with API's)

        But chandru's problem (as i understood it) is that this new excel's instance (obj1) can be used during runtime by the user (since its visible). So if the user closes this Excel's Application instance. Any further code that references Obj1 will cause an error. The easier solution i can think of, is leaving this instance invisible for the user, so he'she cannot close it that easily.

        But then again, sometimes i missunderstand the questions, and give solutions that have nothing to do with the subject.

        Kad

        Comment

        Working...