#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Location
    Bristol UK
    Posts
    1
    Rep Power
    0

    Question Loading a Form At startup


    Hi,

    Can anyone help ????????

    I want a form to load in excel when the file opens and deactivate all other options until the user has made an input into the form and clicked a button.

    The form is a user form created in VBA


    Thanks
  2. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Posts
    5
    Rep Power
    0
    Hi,
    Here is some some code i used before. Hope it helps.

    'Excel Template Variables
    Dim xlRptAp As New Excel.Application
    Dim xlRptWb As New Excel.Workbook
    Dim xlRptDst As String
    Dim xlRptSrcPath As String

    'Connect to Excel
    Set xlRptAp = CreateObject("Excel.Application")
    'Make Excel Visible
    xlRptAp.Visible = True
    'define the Excel File directory
    xlRptSrcPath = "d:\Reports\templates\MyReports.xls"


    'Connect to Excel Report Workbook
    Set xlRptWb = xlRptAp.Workbooks.Open(xlRptSrcPath )

    'Connect to Excel Report Workbook
    xlRptAp.Workbooks(1).Activate

    ' call Excel Auto_Open macro to generate the Reports
    ' call your macro or function to process the Excel file
    xlRptAp.ActiveWorkbook.RunAutoMacros xlAutoOpen
    xlRptAp.ActiveWorkbook.Save

    xlRptAp.Application.ActiveWorkbook.Close
    xlRptAp.Application.Quit

    Jim Guo

IMN logo majestic logo threadwatch logo seochat tools logo