I got this code from a Tek-Tips programmer and would like to expand on it.
Question: I know a Macro will run a vb Function: but have not had any luck getting a Macro to run a vb Private Sub. Can a Macro run a Private Sub ? How ?
Here is the Sub:
------------------
Private Sub CEB_Click()
On Error GoTo Err_CEB_Click
'FormSaveAs(strName As String)
'On Error GoTo ErrSaveAs
DoCmd.SelectObject acForm, "HTMLCEB", True
DoCmd.RunCommand acCmdSaveAsReport
Exit_CEB_Click:
Exit Sub
Err_CEB_Click:
MsgBox Err.Description
Resume Exit_CEB_Click
End Sub
----------------
The above Sub is attached to a Command Button on a Form. The Form itself has the following Sub attached to it.
-----------------
Private Sub Form_Open()
DoCmd.SetWarnings True
End Sub
--------------------
Private Sub Form_Close(Cancel As Integer)
DoCmd.SetWarnings False
End Sub
-------------------
An Explaination:
The CEB is one of two phone lists made with List Boxes on a form. This way I can publish to our internal Web Page a nice looking one page Snapshot with different colors, fonts and special formatting. Access 2002 has no option for exporting a form as a Snapshot. If a form with list boxes is exported as a .html (or the other option) no data shows in the list boxes. So I save the forms as reports that allow a save to the Web as a Snapshot. I hope this is clear; if so please help. thanks
Question: I know a Macro will run a vb Function: but have not had any luck getting a Macro to run a vb Private Sub. Can a Macro run a Private Sub ? How ?
Here is the Sub:
------------------
Private Sub CEB_Click()
On Error GoTo Err_CEB_Click
'FormSaveAs(strName As String)
'On Error GoTo ErrSaveAs
DoCmd.SelectObject acForm, "HTMLCEB", True
DoCmd.RunCommand acCmdSaveAsReport
Exit_CEB_Click:
Exit Sub
Err_CEB_Click:
MsgBox Err.Description
Resume Exit_CEB_Click
End Sub
----------------
The above Sub is attached to a Command Button on a Form. The Form itself has the following Sub attached to it.
-----------------
Private Sub Form_Open()
DoCmd.SetWarnings True
End Sub
--------------------
Private Sub Form_Close(Cancel As Integer)
DoCmd.SetWarnings False
End Sub
-------------------
An Explaination:
The CEB is one of two phone lists made with List Boxes on a form. This way I can publish to our internal Web Page a nice looking one page Snapshot with different colors, fonts and special formatting. Access 2002 has no option for exporting a form as a Snapshot. If a form with list boxes is exported as a .html (or the other option) no data shows in the list boxes. So I save the forms as reports that allow a save to the Web as a Snapshot. I hope this is clear; if so please help. thanks