Solved AutoExec Macro (1 Viewer)

Romio_1968

Member
Local time
Today, 04:10
Joined
Jan 11, 2023
Messages
126
Hello World...

I have a procedure in a standard module and I want to run it in AutoExec Macro
For some reason i don't understand, Access does not recognize the procedure, so the macro fails.
I tried to run call the procedure using the Run Code in the macro.
The procedure is compiled.

Here is the Code
Code:
Public Sub FormatForms()
    Dim frm As Form
    Dim ctl As Control
    
    For Each frm In CurrentDb.Containers("Forms").Documents
        If frm.Name <> "AdminP_Frm" And frm.Name <> "Scrap_Frm" Then
            frm.Width = 28.3 * 567
            For Each ctl In frm.Controls
                Select Case ctl.ControlType
                    Case acLabel, acImage, acFrame, acTextBox, acComboBox, acListBox, acOptionButton, acCheckBox, acCommandButton, acToggleButton, acTabCtl, acPage
                        ctl.Left = ctl.Left + 5.15 * 567
                    Case Else
                        'Do nothing
                End Select
            Next ctl
        End If
    Next frm
End Sub

Can anybody tell me what am I doing wrong here?
 

sonic8

AWF VIP
Local time
Today, 03:10
Joined
Oct 27, 2015
Messages
998
IIRC, the RunCode action of a macro only supports functions, not sub procedures.
 

Romio_1968

Member
Local time
Today, 04:10
Joined
Jan 11, 2023
Messages
126
True... I changed it into a function and it works
But i discarded it.
Messy job

Thank you,
 

Users who are viewing this thread

Top Bottom