Skip to content

Instantly share code, notes, and snippets.

@felixlindemann
Last active August 29, 2015 14:04
Show Gist options
  • Save felixlindemann/23ccec1aaa99a9bc805a to your computer and use it in GitHub Desktop.
Save felixlindemann/23ccec1aaa99a9bc805a to your computer and use it in GitHub Desktop.
VBA: Create Userform in MS-Access Programatically
Option Compare Database
Public Function getEmptyForm() As Object
'This is to stop screen flashing while creating form
' Application.VBE.MainWindow.Visible = False
Set getEmptyForm = Application.VBE.ActiveVBProject.VBComponents.Add(3)
End Function
Public Sub showForm(ByVal frm As Object)
VBA.UserForms.Add(frm.Name).Show
End Sub
Public Sub closeForm(ByVal frm As Object)
Application.VBE.ActiveVBProject.VBComponents.Remove frm
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment