ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Opening in a new book (https://www.excelbanter.com/excel-programming/337620-opening-new-book.html)

ceemo[_13_]

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?


--
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

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

ceemo[_14_]

Opening in a new book
 

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

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

ceemo[_15_]

Opening in a new book
 

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

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


All times are GMT +1. The time now is 02:24 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com