Hi again, not sure if this is possible but I was wondering if a macro could be written to send a netsend message to a particular PC on the network when a certain sheet is accessed? any thoughts (running NT)
Hi me again, sorry to be cheeky but I'm just trying to keep the thread current In the hope of an answer. I can't see any reason why it wouldn't be possible. Suppose it hinges on being able to run a Dos prompt command from within Excel.
There was a type in my reply, which I quickly edited, but maybe not quickly enough.
Runs an executable program and returns a Variant (Double) representing the program's task ID if successful, otherwise it returns zero.
The Shell function syntax has these named arguments:
pathname Required; Variant (String). Name of the program to execute and any required arguments or command-line switches; may include directory or folder and drive. On the Macintosh, you can use the MacID function to specify an application's signature instead of its name. The following example uses the signature for Microsoft Word:
windowstyle Optional. Variant (Integer) corresponding to the style of the window in which the program is to be run. If windowstyle is omitted, the program is started minimized with focus. On the Macintosh (System 7.0 or later), windowstyle only determines whether or not the application gets the focus when it is run.
The windowstyle named argument has these values:
Constant Value Description
vbHide 0 Window is hidden and focus is passed to the hidden window. The vbHide constant is not applicable on Macintosh platforms.
vbNormalFocus 1 Window has focus and is restored to its original size and position.
vbMinimizedFocus 2 Window is displayed as an icon with focus.
vbMaximizedFocus 3 Window is maximized with focus.
vbNormalNoFocus 4 Window is restored to its most recent size and position. The currently active window remains active.
vbMinimizedNoFocus 6 Window is displayed as an icon. The currently active window remains active.
If the Shell function successfully executes the named file, it returns the task ID of the started program. The task ID is a unique number that identifies the running program. If the Shell function can't start the named program, an error occurs.
On the Macintosh, vbNormalFocus, vbMinimizedFocus, and vbMaximizedFocus all place the application in the foreground; vbHide, vbNoFocus, vbMinimizeFocus all place the application in the background.
Note By default, the Shell function runs other programs asynchronously. This means that a program started with Shell might not finish executing before the statements following the Shell function are executed.
i've not checked the below what i've written but this is just an idea.
When the excel file is opened by a user on LAN, a log file will be created in the folder (name: MySharedFolder) in your PC. The user who has opened the file and the access time will be logged in the file LogFile.txt
You have to change IISHDPE with your PC's network name.
Private Declare Function GetUserName Lib "advapi32.dll" _
Alias "GetUserNameA" (ByVal lpBuffer As String, _
Nsize As Long) As Long
Private Sub Workbook_Open()
Dim Buffer As String * 100
Dim BuffLen As Long
BuffLen = 100
GetUserName Buffer, BuffLen
Open "IISHDPEMySharedFolderLogFile.txt" For Append As #1
Print #1, Left(Buffer, BuffLen - 1), Now
Edit: i've just added the api which is necessary to find the user name.
Second edit: it's strange but, i saw that some of the backslashes are not seen in the code i've just posted. There should be back slashes between IISHDPE and MySharedFolder, and also at the beginning of IISHDPE, there should be double back slash. This message was edited by Raider on 2002-11-11 09:27 This message was edited by Raider on 2002-11-11 09:31
Hi, Thanks Raider, not sure if this is what I'm looking for. Users are not always on the LAN some are on WAN too. Plus I'm not entirely sure what your code does. I'm not looking to track users and what time they logged on etc (I already have code to do that) I eventually want to use this method to contact different members of a group depending on the options chosen within excel. Dose anyone have any more suggestions?