Module that Opens a Excel File (1 Viewer)

BenSteckler

Addicted to Programming
Local time
Today, 11:14
Joined
Oct 4, 2000
Messages
44
Is there a command that opens a specific Excel File?
 

llkhoutx

Registered User.
Local time
Today, 05:14
Joined
Feb 26, 2001
Messages
4,018
There is a series of commands to open an Excel:

************************
strFName = LCase(DBPath() & "\schdata.xls")
DoCmd OutputTo A_TABLE, "qfsubScheduleData", A_FORMATXLS, strFName, False
Main_ViewExcelFile strFName
******************
Sub Main_ViewExcelFile (ByVal strFile As String)
On Error GoTo Err_Main_ViewExcelFile

Dim objExcel As Object
Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = True
objExcel.Workbooks.Open strFile
Set objExcel = Nothing
'Beep
'MsgBox "File " & strFile & " has been created. Please open the file using Excel.", MB_ICONINFORMATION

Exit_Main_ViewExcelFile:
Exit Sub

Err_Main_ViewExcelFile:
MsgBox "Error (" & Err & "): " & Error, MB_ICONExclamation
Resume Exit_Main_ViewExcelFile

End Sub
 

ElsVanMiert

Registered User.
Local time
Today, 11:14
Joined
Dec 14, 2000
Messages
152
Alternatively, you could integrate the XL file in your table with the EXCEL! wizard (www.unsoftwareag.com). Then you can open your XL file with one button click.
 

Keith P

Registered User.
Local time
Today, 11:14
Joined
Oct 11, 2000
Messages
122
A further option is to create a hyperlink address on a label, button or in code and follow the hyperlink.
 

Users who are viewing this thread

Top Bottom