Messaging from Excel...

paddymack

Board Regular
Joined
Oct 24, 2002
Messages
143
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)
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
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.
 
Upvote 0
The Shell function runs an executable program.
This message was edited by Andrew Poulsom on 2002-11-11 08:46
 
Upvote 0
I'm sorry but the what function? I've never heard of that one, please provide more information.....
 
Upvote 0
There was a type in my reply, which I quickly edited, but maybe not quickly enough.

Shell Function

Runs an executable program and returns a Variant (Double) representing the program's task ID if successful, otherwise it returns zero.

Syntax

Shell(pathname[,windowstyle])

The Shell function syntax has these named arguments:

Part Description
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:
Shell MacID("MSWD")
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.

Remarks

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.
 
Upvote 0
Sorry, hope I'm not being thick, but I'm not trying to run an executable program here, just a DOS command.
 
Upvote 0
On 2002-11-11 08:58, paddymack wrote:
Sorry, hope I'm not being thick, but I'm not trying to run an executable program here, just a DOS command.

It's probably the same thing, although I'm not familiar with netsend. Try it and see.
 
Upvote 0
Hi;

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
ChDir "IISHDPEMySharedFolder"
Open "IISHDPEMySharedFolderLogFile.txt" For Append As #1
Print #1, Left(Buffer, BuffLen - 1), Now
Close #1
End Sub


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
 
Upvote 0
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?
 
Upvote 0

Forum statistics

Threads
1,213,490
Messages
6,113,956
Members
448,535
Latest member
alrossman

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top