Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Determining how excel was started

I have an Auto_Open macro in a file in the XLStart directory that I want to
behave differently if Excel is launched just by running the .exe or by
double clicking on an .xls file.
There has been a suggestion of checking for the book1.xls file but because I
have files in the XLStart directory the book1.xls file does not get created
when excel is launched.

Is there any way of telling programatically how excel of started? In my old
unix days we could examine the parameter lines into the programe.

Thanks


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Determining how excel was started

"Gilgamesh" wrote in message
...
I have an Auto_Open macro in a file in the XLStart directory that I want to
behave differently if Excel is launched just by running the .exe or by
double clicking on an .xls file.
There has been a suggestion of checking for the book1.xls file but because
I have files in the XLStart directory the book1.xls file does not get
created when excel is launched.

Is there any way of telling programatically how excel of started? In my
old unix days we could examine the parameter lines into the programe.

Thanks


I should have mentioned I'm using Excel 2003




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 163
Default Determining how excel was started

Hi,

maybe this is a silly idea,
as I am just trying to get to grips with Excel.

If Excel was not started by double clicking on a file,
then only the Workbooks in the XLStart-folder are loaded.
To me it seems, they are loaded in alphabetical order.

So if your auto_open macro is in the last of the loaded
files, simply check whether the number of open workbooks
equals the number of Excel-files in XLStart.
If so, Excel was not started by double clicking on a file.

If you auto_open macro is not in the last file to be loaded,
then you could use application.ontime and wait some seconds,
til all files from XLStart are loaded. Like this:

Sub auto_open()
Application.OnTime Now + TimeValue("00:00:05"), "Checkbook"
End Sub

Sub checkbook()
If Workbooks.Count 3 Then
MsgBox "Excel was started with file"
Else
MsgBox "Excel was started without file"
End If
End Sub

Not a very safe approach, though.

--
Greetings from Bavaria, Germany

Helmut Weber

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Determining how excel was started

Gilgamesh,
There are ways to read Excel's Command line arguments. Not sure what it
would give you, but may include a filename if .xls file is clicked.
Can't find a link, but I have seen such.
Try a Google.

NickHK

"Gilgamesh" wrote in message
...
I have an Auto_Open macro in a file in the XLStart directory that I want

to
behave differently if Excel is launched just by running the .exe or by
double clicking on an .xls file.
There has been a suggestion of checking for the book1.xls file but because

I
have files in the XLStart directory the book1.xls file does not get

created
when excel is launched.

Is there any way of telling programatically how excel of started? In my

old
unix days we could examine the parameter lines into the programe.

Thanks




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
Get Started tab in Excel 2007 doesn't show Mark N Excel Discussion (Misc queries) 0 April 15th 08 08:04 PM
Get Started Tab in Excel 2007 Bill G[_2_] Setting up and Configuration of Excel 3 June 10th 07 08:28 PM
Excel started, but not the file chengsun Excel Discussion (Misc queries) 0 May 18th 06 06:20 AM
Can Excel be started minimized? Bernie Setting up and Configuration of Excel 1 August 24th 05 09:36 PM
remove "getting started" from excel 2003 inenewbl Excel Discussion (Misc queries) 1 August 19th 05 04:45 PM


All times are GMT +1. The time now is 03:00 PM.

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

About Us

"It's about Microsoft Excel"