Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old December 3rd, 2010, 12:42 AM
Registered User
Join Date: Dec 2010
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Loading a Form Automatically When Excel Starts

Hello Everybody,

I'm new to these forums (and VB/VBA) so please bear with me if I'm not doing this correctly. I've designed an application that runs on a form (in vba) but I don't want anyone to see my code, I just need to activate the form automatically. Is there a way of doing this? A friend of mine suggested that I port my code to VB6 and then save it as an executable but this is too much work for me cuz there'll be a lot of compatibility issues etc.

Currently, I run the excel file and then press 'ALT' + 'F11' followed by 'F5' to activate the form. However this means that anyone that does this can view the source code and i understandably don't want that. Is there an Excel switch that can do that, or some Add In? Btw, I know very little about add ins.

I look forward to reading your responses.


Last edited by Ben1972; December 3rd, 2010 at 12:45 AM.. Reason: typo
Old December 8th, 2010, 12:33 PM
JP JP is offline
Authorized User
Join Date: Apr 2008
Posts: 57
Thanks: 1
Thanked 3 Times in 3 Posts

Save the workbook as an add-in, but you'll need to write the code that automatically runs the form. Something like

Private Sub Workbook_Open()
  Dim myForm As myForm ' or whatever your userform is named
  Set myForm = New myForm
End Sub
Once you save the workbook as an addin, and install it, the code runs every time Excel (actually, the addin) opens.

JP SoftTech

Similar Threads
Thread Thread Starter Forum Replies Last Post
start a context automatically, while tomcat starts sureshrgsl Apache Tomcat 4 May 17th, 2007 06:46 AM
start a context automatically, while tomcat starts sureshrgsl BOOK: Professional Apache Tomcat 0 April 16th, 2007 02:14 AM
Automatically attach Excel spreadsheet to Email nbaj2k Excel VBA 3 August 1st, 2006 12:15 PM
automatically submit a form crmpicco Classic ASP Basics 1 March 30th, 2005 09:13 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.