+ Reply to Thread
Results 1 to 6 of 6

Opening in a new book

  1. #1
    Forum Contributor
    Join Date
    06-15-2004
    Posts
    246

    Opening in a new book

    Is there anyway i can get my spreadsheet to always open in a fesh version of excel even if i already have other books open?

  2. #2
    Dave Peterson
    Guest

    Re: Opening in a new book

    I think the safest thing to do is start another instance of excel.

    windows start button|run
    excel
    (hit enter)
    then file|open that other workbook.

    But by having multiple instances open, you'll find somethings won't work between
    the two (copying formulas from one instance to another instance, for example).

    ceemo wrote:
    >
    > Is there anyway i can get my spreadsheet to always open in a fesh
    > version of excel even if i already have other books open?
    >
    > --
    > ceemo
    > ------------------------------------------------------------------------
    > ceemo's Profile: http://www.excelforum.com/member.php...o&userid=10650
    > View this thread: http://www.excelforum.com/showthread...hreadid=396806


    --

    Dave Peterson

  3. #3
    Forum Contributor
    Join Date
    06-15-2004
    Posts
    246

    Coded

    I was hoping to be able to do this using code. Perhaps a piece of code that on work book open checks to see how many books are open if more than one if then runs code to open it in a new excel application and close the current spreadsheet.

  4. #4
    Dave Peterson
    Guest

    Re: Opening in a new book

    This might get you started--but I think it's a mistake!

    Option Explicit
    Sub testme()

    Dim curWkbk As Workbook
    Dim myFileName As Variant
    Dim xlApp As Excel.Application

    myFileName = Application.GetOpenFilename(filefilter:="Excel files, *.xls")

    If myFileName = False Then
    Exit Sub 'user hit cancel
    End If

    Set curWkbk = Nothing
    On Error Resume Next
    Set curWkbk = ActiveWorkbook
    On Error GoTo 0

    If curWkbk Is Nothing Then
    Set xlApp = Application
    Else
    Set xlApp = CreateObject("Excel.Application")
    xlApp.Visible = True
    End If

    xlApp.Workbooks.Open Filename:=myFileName

    End Sub


    Notice that in that new instance, none of your addins got loaded. (You'll have
    to load them yourself.) And you'll have to make sure this code is available in
    every instance of excel that you start--so you can reuse it.

    I surely wouldn't do this.



    ceemo wrote:
    >
    > I was hoping to be able to do this using code. Perhaps a piece of code
    > that on work book open checks to see how many books are open if more
    > than one if then runs code to open it in a new excel application and
    > close the current spreadsheet.
    >
    > --
    > ceemo
    > ------------------------------------------------------------------------
    > ceemo's Profile: http://www.excelforum.com/member.php...o&userid=10650
    > View this thread: http://www.excelforum.com/showthread...hreadid=396806


    --

    Dave Peterson

  5. #5
    Forum Contributor
    Join Date
    06-15-2004
    Posts
    246

    FROm the beginging

    May be i should exlain why i want this there may be another way.

    I am using the below to close all menu's when opening a workbook.

    Private Sub Workbook_Open()
    Dim oCB As CommandBar
    For Each oCB In Application.CommandBars
    oCB.Enabled = False
    Next oCB

    mFormulaBar = Application.DisplayFormulaBar
    Application.DisplayFormulaBar = False

    application.ignoreremoterequests=true

    End Sub


    the last line before end sub stops other work books being opened in the current excel app and opens a new app for them. However if excel is already open when i open this code the other workbooks are affected by the menu changes. This is what i dont want.

  6. #6
    Dave Peterson
    Guest

    Re: Opening in a new book

    And you're opening the files by double clicking on them in windows explorer???

    You could try:

    Tools|options|General tab|Ignore other applications (check it)

    Then double click on the workbook in windows explorer.

    And be aware that turning this setting on sometimes gives errors with workbooks
    that contain spaces in their path/name:

    C:\my documents\excel\my book.xls

    The error will look kind of like:
    cannot find c:\my ..
    then
    cannot find documents\excel\my
    then
    cannot find book.xls



    ceemo wrote:
    >
    > May be i should exlain why i want this there may be another way.
    >
    > I am using the below to close all menu's when opening a workbook.
    >
    > Private Sub Workbook_Open()
    > Dim oCB As CommandBar
    > For Each oCB In Application.CommandBars
    > oCB.Enabled = False
    > Next oCB
    >
    > mFormulaBar = Application.DisplayFormulaBar
    > Application.DisplayFormulaBar = False
    >
    > application.ignoreremoterequests=true
    >
    > End Sub
    >
    > the last line before end sub stops other work books being opened in the
    > current excel app and opens a new app for them. However if excel is
    > already open when i open this code the other workbooks are affected by
    > the menu changes. This is what i dont want.
    >
    > --
    > ceemo
    > ------------------------------------------------------------------------
    > ceemo's Profile: http://www.excelforum.com/member.php...o&userid=10650
    > View this thread: http://www.excelforum.com/showthread...hreadid=396806


    --

    Dave Peterson

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1