Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to we know if how many times and how many users used our macro.. any help appreciated..

Status
Not open for further replies.

Rangraop

Automotive
Mar 19, 2014
21
0
0
US
Hello Everybody,
This is very nice platform to share and enhance our knowledge. Only because of this site I could speed up my work.
I came with a query that, when we create a macro, can we create some code such that we will get know that, how many times our macro has been used. I believe based on this we could calculate how many man hrs we saved... :) so that we could present our achievement to management.
Any help on this would really be appreciated..
I have just taken a portion of code from cklong (Automotive) (OP)'s post
Does anybody know how to modify this code to use as catia macro.. I'm really weak in programming [sad]
**************************
Dim path As String
Dim filename As String
Dim scrpt As String
Dim objFSO, objReadFile, contents
Dim ccontents As String
On Error Resume Next

path = "c:\temp\" 'location of file
filename = "test.txt" 'add text name
scrpt = "test" 'name of macro

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objReadFile = objFSO.OpenTextFile(path & filename, 1, False)

ccontents = objReadFile.ReadAll
If ccontents = "" Then
ccontents = 0
End If

ccontents = ccontents + 1
mut = Round(ccontents / 25)

If ccontents = 100 Then
MsgBox "You have use " & scrpt & " " & ccontents & "times you must really like this program."
ElseIf ccontents = 1 Then
MsgBox "Thank you for trying " & scrpt & " I hope you enjoy this program."
ElseIf ccontents = 25 * mut Then
MsgBox "You have use " & scrpt & " " & ccontents & "times. I think you owe me a coffee"
End If

Set Datos = CATIA.fileSystem.CreateFile(path & filename, True)

Set ostream = Datos.OpenAsTextStream("ForAppending")
ostream.Write ccontents & Chr(10)
ostream.Close

********************************
 
Replies continue below

Recommended for you

Thanks ferdo for your feedback on this. I have searched through this forum using keywards like log file and timestamp, but have not found any useful.
Can you please point out any example that could be useful for me?

Thanks you,

Rangrao Padiyar
 
Status
Not open for further replies.
Back
Top