I am currently opening and Excel workbook from Access for the user to review and verify.
What I want to happen is:
This is my code for opening the Excel file.
- <LI>User selects the file to open
<LI>User closes workbook.
<LI> Form now asks if the user wants to mark selected file as verified.
<LI>User clicks Yes or No
Dim oApp As Object
Dim oWbk As Object
Dim PathFile As String
PathFile = "xxxxxxdata01COMMON2ASPartnerTestParterFiles" & Me.lstFiles.Column(1, Me.lstFiles.ListIndex)
Set oApp = CreateObject("Excel.Application")
Set oWbk = oApp.Workbooks.Open(PathFile)
oApp.Visible = True
On Error Resume Next
oApp.UserControl = True
VerifyMsg = True
On return (Got Focus)
Dim resp As VbMsgBoxResult
Dim strSQL As String
If VerifyMsg = True Then
resp = SndMsg("EmailVerify0001", vbYesNo, Me.lstFiles.Column(1, Me.lstFiles.ListIndex))
If resp = vbYes Then
strSQL = "UPDATE tbl_SentMail_Log SET tbl_SentMail_Log.MailFileVerified = True " _
& "WHERE (((tbl_SentMail_Log.MailId) = " & Me.lstFiles.Column(0, Me.lstFiles.ListIndex) & "));"
VerifyMsg = False
I need to know how to lose the focus after I open the Excel File (#4) and then give it back to the form after the user is done (#5) with the file so I can ask if the file is correct.