I'm trying to strip the comments from a module and then iterate through the module finding queries, macros,etc. already in the db.
I am using a modified version found in the Access Developer's Handbook (adh). The code is as below:
***********************************************
Dim cLine As Long
If ctrType = acModule Then
If aDoc.Name <> "Module1" Then
DoCmd.OpenModule aDoc.Name
With Modules(aDoc.Name)
On Error Resume Next
For cLine = .CountOfLines - 1 To 0 Step -1
If InStr(Trim(.Lines(cLine, 1)), "'"
= 1 Then
'.DeleteLines cLine, 1
Modules(aDoc.Name).DeleteLines cLine, 1
End If
Next
End With
DoCmd.Close acModule, aDoc.Name, acSaveNo
End If
End If
********************************************************
I keep getting getting a message "Can't enter break mode at this time" at the line:
Modules(aDoc.Name).DeleteLines cLine,1
I don't know why I am getting this messge and causes the process to stop working. What's funny is that it does not appear to be an error because my On Error Resume Next does not seem to help.
If anyone has any ideas or can help me, I sure would appreciate it.
Thanks,
Rewdee
I am using a modified version found in the Access Developer's Handbook (adh). The code is as below:
***********************************************
Dim cLine As Long
If ctrType = acModule Then
If aDoc.Name <> "Module1" Then
DoCmd.OpenModule aDoc.Name
With Modules(aDoc.Name)
On Error Resume Next
For cLine = .CountOfLines - 1 To 0 Step -1
If InStr(Trim(.Lines(cLine, 1)), "'"
'.DeleteLines cLine, 1
Modules(aDoc.Name).DeleteLines cLine, 1
End If
Next
End With
DoCmd.Close acModule, aDoc.Name, acSaveNo
End If
End If
********************************************************
I keep getting getting a message "Can't enter break mode at this time" at the line:
Modules(aDoc.Name).DeleteLines cLine,1
I don't know why I am getting this messge and causes the process to stop working. What's funny is that it does not appear to be an error because my On Error Resume Next does not seem to help.
If anyone has any ideas or can help me, I sure would appreciate it.
Thanks,
Rewdee