If a workbook is closed directly from excel vba and then opened from code within VBA.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • prakashsakthivel
    New Member
    • Oct 2007
    • 57

    If a workbook is closed directly from excel vba and then opened from code within VBA.

    What I want to know is that while one excel application is closed by VBA code from module, another excel application has to be opened.
    That means, I have written code to open new excel sheet in the Workbook_Before Close.

    I have written a code like workbooks.open (Path\filename)

    If a workbook is closed directly from excel vba and then opened from code within VBA. It is not working.

    It is working fine while we close excel application manually. But it is not working while try to do through VBAcode.

    Could you Please help me.

    I am using Excel 2000.

    Musai.
  • Dököll
    Recognized Expert Top Contributor
    • Nov 2006
    • 2379

    #2
    Originally posted by prakashsakthive l
    What I want to know is that while one excel application is closed by VBA code from module, another excel application has to be opened.
    That means, I have written code to open new excel sheet in the Workbook_Before Close.

    I have written a code like workbooks.open (Path\filename)

    If a workbook is closed directly from excel vba and then opened from code within VBA. It is not working.

    It is working fine while we close excel application manually. But it is not working while try to do through VBAcode.

    Could you Please help me.

    I am using Excel 2000.

    Musai.
    Greetings, Musai!

    I read your post and felt it would be advantageous if code were also posted, you can post at least part of it, or perhaps all, just someone may see what's a miss, all in all it would be a effective way to help you.

    You may also find something already posted if you fetch deeper into the pages through search terms up above.

    Good luck with the project!

    Dököll

    Comment

    • prakashsakthivel
      New Member
      • Oct 2007
      • 57

      #3
      Thanks for updates.

      In .bas Module, I have written the application after executing some task.

      Public sub close_file
      ThisWorkbook.Cl ose savechanges:=Fa lse
      End sub

      Ex:

      Private Sub Workbook_Before Close(Cancel As Boolean)
      Dim strfile as Strfile
      Strfile=”c:\Tes t.xls”
      Workbooks.Open strfile
      End Sub

      While try to close the application through VBA code and open another excel application it is not working.

      That means I am trying to close through “close_file” the procedure.

      It is working fine while try to close manually.

      Could anybody tell me about this issue.

      Regards
      musai
      Last edited by prakashsakthivel; May 12 '08, 12:07 PM. Reason: For remove lines

      Comment

      Working...