acad.dvb

  • Thread starter Thread starter jt
  • Start date Start date

jt

Usenet Archive
Joined
Jan 22, 2000
Messages
18
Reaction score
0
I am trying to run a drawing log program in a network environment . I have a common network location in everyones suppport path where i have a placed an acad.dvb file. the funcvtion in it is attached to the thisdrawing.acaddocument_activate "event" so that the routine will run as soon as the person opens a document. a companion event id run on the begin_close event . The routine will open an instance of Excel and write time & date and loginname to the spreadsheet. Unfortunately it only works reliably on my machine and not the other users,and the Excel file is in a directory that is read-write to the other users, any clues as to how to make this more reliable??? the code is below . TIA for any help

Jim Trainer

Private Sub AcadDocument_Activate
Dim excel As Object
Dim excelsheet As Object
Dim exapp As Object
Dim username As Object
Dim moment As Variant
Dim oflag As String
On Error Resume Next
'Me.Hide
Set excel = GetObject(, "Excel.application")
If Err 0 Then
Err.Clear
Set excel = CreateObject("Excel.application")
If Err 0 Then
MsgBox "Could not load Excel.", vbOKOnly + vbInformation, "Error report" End End If End If On Error GoTo 0 'excel.Visible = True 'remove this line to run the macro without ever seeing Excel Set exapp = excel.workbooks.Open("C:\Program Files\AutoCAD 2000i\dwglog.xls") dwgname = ThisDrawing.GetVariable("dwgname") todaysdate = Date loginame = ThisDrawing.GetVariable("loginname") oflag = "open" moment = now rownum = 2 columnnum = 1 With excel Set excelsheet = excel.ActiveWorkbook.Sheets("sheet1") 'dwg name Do Until excelsheet.Cells(rownum, 1).Value = "" Or excelsheet.Cells(rownum,
1).Value = dwgname
rownum = rownum + 1
Loop
excelsheet.Cells(rownum, 1).Value = dwgname
If excelsheet.Cells(rownum, 1).Value = dwgname Then
columnnum = columnnum + 1
End If
'date
Do Until excelsheet.Cells(rownum, columnnum).Value = "" Or excelsheet.Cells(rownum, columnnum).Value = moment columnnum = columnnum + 1 Loop excelsheet.Cells(rownum, columnnum).Value = moment If excelsheet.Cells(rownum, 1).Value = now Then columnnum = columnnum + 1 End If 'loginame Do Until excelsheet.Cells(rownum, columnnum).Value = "" Or excelsheet.Cells(rownum, columnnum).Value = loginame columnnum = columnnum + 1 Loop excelsheet.Cells(rownum, columnnum).Value = loginame If excelsheet.Cells(rownum, 1).Value = loginame Then columnnum = columnnum + 1 End If 'oflag tag Do Until excelsheet.Cells(rownum, columnnum).Value = "" Or excelsheet.Cells(rownum, columnnum).Value = oflag columnnum = columnnum + 1 Loop excelsheet.Cells(rownum, columnnum).Value = oflag If excelsheet.Cells(rownum, 1).Value = oflag Then columnnum = columnnum + 1 End If excel.ActiveWorkbook.Save excel.ActiveWorkbook.Close excel.Quit End With End Sub
 
Back
Top