Home |
Search |
Today's Posts |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sharon,
Because the procedure use the DataObject variable type, you must have a reference set in your VBA project to the Microsoft Forms 2.0 object library. In your VBA window Tools-References... and put a check in the box for 'Microsoft Forms 2.0 Object Library' Mike "Sharon" wrote: Wow!! Thank you so much - going to try it as soon as I have read through it to understand but it looks absolutely perfect. Thanks again jetted!! -- Sharon "jetted" wrote: Hi Sharon I would use these 3 macro Sub auto_open() 'grab the user name Dim LogFile As String Dim EnvString As String Dim Indx As Long Dim regRoot As Long Indx = 1 Do EnvString = Environ(Indx) If LCase(Left(EnvString, 9)) = "username=" Then 'Lan user id regUserID = Right(EnvString, Len(EnvString) - 9) End If Indx = Indx + 1 Loop Until EnvString = "" Indx = 0 LogFile = "c:\activite.log" ' this must be a common directory ChDir "c:\" donnees = Now() Open LogFile For Append Shared As #1 Print #1, "Excel was openned at: " & donnees & " by " & regUserID Close #1 end sub Sub AUTO_CLOSE() 'close the file Dim LogFile As String Dim EnvString As String Dim Indx As Long Dim regRoot As Long 'Dim applicationClass As New AppEventClass 'Set applicationClass.appl = Application Indx = 1 Do EnvString = Environ(Indx) If LCase(Left(EnvString, 9)) = "username=" Then 'Lan user id regUserID = Right(EnvString, Len(EnvString) - 9) End If Indx = Indx + 1 Loop Until EnvString = "" Indx = 0 LogFile = "c:\activite.log" ChDir "c:\" donnees = Now() Open LogFile For Append Shared As #1 'pointeur adresse, logfile=#1 Print #1, "Closed excel at " & donnees & " by " & regUserID Print #1, "----------------------------------" Close #1 Worksheets("Sheet1").Select ActiveWorkbook.Save End Sub Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range) 'as soon there is a change this is log nom = ActiveSheet.Name refere = Target.Address LogFile = "c:\activite.log" ChDir "c:\" donnees = Now() oldvalue = ActiveCell.Value MsgBox oldvalue Open LogFile For Append Shared As #1 Print #1, "Changes made in workbook: " & nom & " in cell: " & refere & " new input: " & Target & " " & donnees Close #1 'MsgBox Target 'MsgBox refere End Sub -- jetted ------------------------------------------------------------------------ jetted's Profile: http://www.excelforum.com/member.php...o&userid=17532 View this thread: http://www.excelforum.com/showthread...hreadid=558517 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Insert copied cells | Excel Worksheet Functions | |||
Prevent certain cells from being copied | Excel Programming | |||
insert copied cells | Excel Discussion (Misc queries) | |||
How to use macros to copy a range of cells which can exclude some cells which I didn't want to be copied? | Excel Worksheet Functions | |||
Formatting copied cells | Excel Discussion (Misc queries) |