Im looking to put password on one of my value of the listbox and run a code afterwards..so when they click "Export EADM Updates"..they'll put a password..then it'll run that ElseIf statement.


[VBA]'TYPE: Sub
'NAME: ComboInfo_Click()
'Parameters: none
'Purpose: Open the forms designated as Information Catalogue forms.
Private Sub ComboInfo_Click()

ElseIf ComboInfo.Text = "Export EADM Updates" Then

Dim rst As Recordset
Dim dst As Recordset
Dim pst As Recordset
Dim lst As Recordset
Dim objApp As Excel.Application
Dim objBook As Excel.Workbook
Dim objSheet As Excel.Worksheet
Set objApp = New Excel.Application

On Error Resume Next
'This is new 'Your excel spreadsheet file goes here
Set objBook = objApp.Workbooks.Open("I:\Status\EADMUpdates.xlsm")
'Name of sheet you want to export to
Set objSheet = objBook.Worksheets(1)
objBook.Windows(1).Visible = True
'Opens the Query recordset
Set rst = CurrentDb.OpenRecordset("SupplyRetailOffering")
Set dst = CurrentDb.OpenRecordset("MarketingBusinessParty")
Set pst = CurrentDb.OpenRecordset("BusinessOperationsandPlan")
Set lst = CurrentDb.OpenRecordset("FinancialEnterpriseHumanResources")

objSheet.Range("A2:R65000").Select
'Clears the current contents in the workbook range
'With objApp.Application.Selection
' .ClearContents
'End With
'rst/dst Copies the recordset into the worksheet
objSheet.Range("A2").CopyFromRecordset rst
objSheet.Range("A19").CopyFromRecordset dst
objSheet.Range("A33").CopyFromRecordset pst
objSheet.Range("A50").CopyFromRecordset lst
objBook.Save
objBook.Close
rst.Close
dst.Close
pst.Close
lst.Close
objApp.Visible = False
MsgBox "Excel has been Updated.If Error - No Access"

Else
MsgBox "Please make a selection."
End If

End Sub
[/VBA]