Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How to start excel in "safe mode" programmatically

Is there a way to start excel in "safe mode" programmatically.

I am creating an excel application instance as mentioned below:-

Excel.Application excelApp = new Excel.Application ();

I do not want to load add-ins and it's my understanding that the "safe mode"
suppresses all add-ins.

Also, I do not want to affect any other instances of the excel application
which may be running add-ins.

Please advise.

Thanks,
Abhishek
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default How to start excel in "safe mode" programmatically

When I start an excel instance using MSWord, I have to load the addins that I
want to use--since none are loaded when I start Excel this way.

It's not quite safe mode--I still have to disable events in excel before I
open/change/close stuff.

Isn't that what you're seeing with your code and your new excel application?





Abhishek - Oracle wrote:

Is there a way to start excel in "safe mode" programmatically.

I am creating an excel application instance as mentioned below:-

Excel.Application excelApp = new Excel.Application ();

I do not want to load add-ins and it's my understanding that the "safe mode"
suppresses all add-ins.

Also, I do not want to affect any other instances of the excel application
which may be running add-ins.

Please advise.

Thanks,
Abhishek


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 143
Default How to start excel in "safe mode" programmatically

maybe see this work ok

Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _
(ByVal hRegEdit As Long, ByVal lpOperation As String, _
ByVal lpFile As String, ByVal lpParameters As String, _
ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long

Sub StartXLSafemode()
ShellExecute 0, "Open", "excel.exe", "/s", "", 1
End Sub

"Abhishek - Oracle" <Abhishek - wrote in
message ...
| Is there a way to start excel in "safe mode" programmatically.
|
| I am creating an excel application instance as mentioned below:-
|
| Excel.Application excelApp = new Excel.Application ();
|
| I do not want to load add-ins and it's my understanding that the "safe
mode"
| suppresses all add-ins.
|
| Also, I do not want to affect any other instances of the excel application
| which may be running add-ins.
|
| Please advise.
|
| Thanks,
| Abhishek

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How to start excel in "safe mode" programmatically

Thanks a lot for the suggestion.

I got something working using the code below :-

Systen.Diagnostics.Process myProcess = new Process ();
myProcess.StartInfo.FileName = "excel.exe";
myProcess.StartInfo.Arguments = "/safemode";
myProcess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
myProcess.StartInfo.CreateNoWindow = true;
myProcess.Start ();

I can run excel in safe mode as needed.

Now the only thing left is to get the Excel.Application instance from the
above process "myProcess".

I am trying "System.Runtime.InteropServices.Marshal.GetActiveO bject" or
"System.Runtime.InteropServices.Marshal.BindToMoni ker" without any success so
far.
Any ideas are welcome.

Thanks
Abhishek

"Homey" wrote:

maybe see this work ok

Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _
(ByVal hRegEdit As Long, ByVal lpOperation As String, _
ByVal lpFile As String, ByVal lpParameters As String, _
ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long

Sub StartXLSafemode()
ShellExecute 0, "Open", "excel.exe", "/s", "", 1
End Sub

"Abhishek - Oracle" <Abhishek - wrote in
message ...
| Is there a way to start excel in "safe mode" programmatically.
|
| I am creating an excel application instance as mentioned below:-
|
| Excel.Application excelApp = new Excel.Application ();
|
| I do not want to load add-ins and it's my understanding that the "safe
mode"
| suppresses all add-ins.
|
| Also, I do not want to affect any other instances of the excel application
| which may be running add-ins.
|
| Please advise.
|
| Thanks,
| Abhishek

.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM
Start Windows in Safe Mode Kim Excel Discussion (Misc queries) 0 October 9th 06 08:44 PM
Make "Edit" mode default, rather than "Enter"? Greg Boettcher Excel Discussion (Misc queries) 1 July 27th 06 01:46 AM
Excel "mode" function returns different results based on sort orde Mark Neuffer Excel Worksheet Functions 7 April 25th 06 08:15 AM
Merge worksheets in "Share Mode" (Excel 2000) Mark Jackson Excel Programming 0 June 8th 05 07:20 PM


All times are GMT +1. The time now is 09:59 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"