Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Spreadsheet opened by user or programme

Hi, what I'm, wanting to know is if there is a way of knowing if a
spreadsheet was opened by a user clicking on the file name, or if it
was opened by another programme.

something like this:

Private Sub form_activate

If "form was opened by user" then
'do stuff
Else
'form was opened by onother programme - Access in this case
'do other stuff
End if

End Sub

Thanks in advance
Jenni
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Spreadsheet opened by user or programme

Try to use:

Whofrom = Application.Caller
If WhoFrom="xxx" then

Else

End If
--
PeterS

"Jenni" wrote:
Hi, what I'm, wanting to know is if there is a way of knowing if a
spreadsheet was opened by a user clicking on the file name, or if it
was opened by another programme.

something like this:

Private Sub form_activate

If "form was opened by user" then
'do stuff
Else
'form was opened by onother programme - Access in this case
'do other stuff
End if

End Sub

Thanks in advance
Jenni



---
Peter's mail has been inoculated against Virusses.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.530 / Virus Database: 325 - Release Date: 22-10-2003
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Spreadsheet opened by user or programme

From help on Application.UserControl

True if the application is visible or if it was created or started by the
user. False if you created or started the application programmatically by
using the CreateObject or GetObject functions, and the application is
hidden. Read/write Boolean.

--
Regards,
Tom Ogilvy

"Jenni" wrote in message
m...
Hi, what I'm, wanting to know is if there is a way of knowing if a
spreadsheet was opened by a user clicking on the file name, or if it
was opened by another programme.

something like this:

Private Sub form_activate

If "form was opened by user" then
'do stuff
Else
'form was opened by onother programme - Access in this case
'do other stuff
End if

End Sub

Thanks in advance
Jenni



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Spreadsheet opened by user or programme

application.caller doesn't provide the information you describe or what was
suggested by PeterS to the best of my knowledge.

As I suggested, look at Application.UserControl

--
Regards,
Tom Ogilvy

"Jenni" wrote in message
...
I tried

Select Case TypeName(Application.Caller)
Case "Range"
V = Application.Caller.Address
Case "String"
V = Application.Caller
Case "Error"
V = "Error"
Case Else
V = "unknown"
End Select

MsgBox "caller = " & V

And I get Error irrespective of whether it is called by Access or by me
double clicking on the icon. I also tried to trap the error to get an
error number to use for differentiation, but no luck, it does not give
an error, it just opens.

Any other ideas??

Jenni

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Spreadsheet opened by user or programme

Hi,

Application.UserControl gives a value of True irrespective of whether I
start Excel through Access or by double clicking the icon. Perhaps it
makes a difference that I have opened excel using the Shell command from
Access? Here is the code:

retVal = Shell(GetExeFileSpec("Excel.Application") & Space$(1) &
filePath, vbNormalFocus)

and this in the Public Function that passes the value to the shell
command

Case "EXCEL":
Set appObj = CreateObject(strEXEHostClass)
strPath = appObj.Path & "\"
strFileName = "EXCEL.EXE"
strPrompt = "Microsoft Excel"

So it does use the CreateObject function, and the file is hidden. What
am I missing here? Thanks for the help, as I said I am new at this.

Jenni

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
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
formula not working when opened by another user K Excel Discussion (Misc queries) 0 October 27th 08 03:18 PM
Need to Query Excel File Opened by Another User Paul Excel Discussion (Misc queries) 0 December 13th 06 05:57 PM
Shared spreadsheet changes color when opened ny another user. Why Nick DeSimone Excel Worksheet Functions 0 May 26th 06 05:13 PM
Shared spreadsheet changes color when opened ny another user. Why Nick DeSimone Excel Worksheet Functions 0 May 26th 06 05:12 PM
Excel file opened as read-only, if saved by another user GeEf Excel Discussion (Misc queries) 2 August 28th 05 04:29 PM


All times are GMT +1. The time now is 02:47 PM.

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"