Transfer Module to Text File
acCmdOutputToText
Creates a text file copy of the module name passed to it and then opens notepad to display it.
'***************** Code Start *******************
' Code by Terry Wickenden
Sub ModuleOut(strPass As String)
Dim strMsg As String
On Error GoTo ErrHandler
DoCmd.SelectObject acModule, strPass, True
DoCmd.RunCommand acCmdOutputToText
SubExit:
Exit Sub
ErrHandler:
Select Case Err.Number
Case 2544 'Probably an invalid name of module
strMsg = strPass & " is not a valid module name."
strMsg = strMsg & vbCrLf & "Please try again."
MsgBox strMsg
Resume SubExit
Case Else
strMsg = Err.Number & vbCrLf & Err.Description
MsgBox strMsg
Resume SubExit
End Select
End Sub
'****************** Code End ********************