Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 08-22-2022, 09:41 AM
MC147 MC147 is offline Run procedure when a form is opened Windows 10 Run procedure when a form is opened Office 2021
Advanced Beginner
Run procedure when a form is opened
 
Join Date: Feb 2022
Posts: 34
MC147 is on a distinguished road
Default Run procedure when a form is opened

I am sure this must be simple, but how do I run a vba subroutine automatically when a form is opened. Can't seem to figure this out. Is there something like a Form_Open() event that is called when the form opens?
Reply With Quote
  #2  
Old 08-22-2022, 03:20 PM
Guessed's Avatar
Guessed Guessed is offline Run procedure when a form is opened Windows 10 Run procedure when a form is opened Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,932
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

Are you talking about a VBA userform?

If so you can use UserForm_Initialize as the macro.

This link might be useful for you... Initialize an Excel VBA User Form
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
  #3  
Old 08-22-2022, 04:44 PM
MC147 MC147 is offline Run procedure when a form is opened Windows 10 Run procedure when a form is opened Office 2021
Advanced Beginner
Run procedure when a form is opened
 
Join Date: Feb 2022
Posts: 34
MC147 is on a distinguished road
Default

Andrew - yes thanks that worked - I knew it must be simple.
Funny thing is, I could not see any events available in the codes right hand drop down list - just the word (Declarations). When I created the UserForm_Initialize event manually suddenly there were a whole load of other events available such as Activate, AddControl etc.
Had I been able to see this list when the form was first created without any code, it would have been obvious.
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
MAPItoMIMEStm procedure of IConverterSession instance free@ranger Outlook 0 01-20-2020 10:29 AM
Can't finish update procedure yosbeck Office 1 04-21-2017 04:27 AM
Run procedure when a form is opened Run Macro anytime new mail message form is opened starrouter Outlook 1 02-24-2013 11:29 AM
excel where is procedure being called from davids67 Excel Programming 1 11-18-2011 06:48 AM
Document selection procedure kennethc Word 0 09-15-2010 02:56 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 02:43 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft