I've got an small issue that I'm a little stuck on.
After exporting data to Excel, the user is asked if he/she would like to open the file that has just been created.
Problem being that the Excel file does not get the focus after it has been opened.
Here's the code:
Me.Form.SetFocus
DoCmd.OutputTo acOutputTable, "CSV_Export", acFormatXLS, MyPath, False
Title = "Program Data File - System information"
Msg = "Exportación completada: " & MyPath & Chr(9) & Chr(10) & Chr(9) & Chr(10) & "Do you want to open the Excel file now?"
DgDef = 4 + 32 + 256
Reply = MsgBox(Msg, DgDef, Title)
If Reply = 7 Then
Response = acDataErrContinue
Else
Appc = """" & [Forms]![CSV_Form]![Destino] & """"
Call Shell("excel.exe " & Appc, vbNormalFocus)
If I delete the delete the Me.Form.SetFocus statement, everthinbg works fine, but when my Db is changed to .mde, I get a 2046 Error message.
Is there any way I can send the focus to Excel after the file is opened?
Cheers guys,
JMC
After exporting data to Excel, the user is asked if he/she would like to open the file that has just been created.
Problem being that the Excel file does not get the focus after it has been opened.
Here's the code:
Me.Form.SetFocus
DoCmd.OutputTo acOutputTable, "CSV_Export", acFormatXLS, MyPath, False
Title = "Program Data File - System information"
Msg = "Exportación completada: " & MyPath & Chr(9) & Chr(10) & Chr(9) & Chr(10) & "Do you want to open the Excel file now?"
DgDef = 4 + 32 + 256
Reply = MsgBox(Msg, DgDef, Title)
If Reply = 7 Then
Response = acDataErrContinue
Else
Appc = """" & [Forms]![CSV_Form]![Destino] & """"
Call Shell("excel.exe " & Appc, vbNormalFocus)
If I delete the delete the Me.Form.SetFocus statement, everthinbg works fine, but when my Db is changed to .mde, I get a 2046 Error message.
Is there any way I can send the focus to Excel after the file is opened?
Cheers guys,
JMC