Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Newsgroup Archive
Excel Newsgroups
Excel Misc
Opening excel 2010 spreadsheet from Access
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
Reply to thread
Message
[QUOTE="GS, post: 7415100"] Here's a reusable function that will work with whatever version of Excel is the default... In a standard module: Public appXL As Object Const sXLS_TO_OPEN$ = "C:\TASC\apps\TASCSpredGen.xls" '//edit to suit Function OpenExcelFile(FileName$) As Boolean Dim wkb As Object On Error GoTo errexit Set appXL = CreateObject("Excel.Application") If Not appXL Is Nothing Then Set wkb = appXL.Workbooks.Open(FileName) errexit: OpenExcelFile = (Not wkb Is Nothing) Set wkb = Nothing End Function 'OpenExcelFile In the procedure that currently opens the file, replace that code with... If OpenExcelFile(sXLS_TO_OPEN) Then appXL.Visible = True: appXL.UserControl = True Else appXL.Quit: Call Notify_FileOpenFailure(sXLS_TO_OPEN) End If Set appXL = Nothing '//release it from memory ...so if the file opened successfully you can turn the Excel instance over to the user by making it visible (otherwise it remains hidden), and allowing user control. If unsuccessful you could notify the user there was a problem opening the file... Sub Notify_FileOpenFailure() MsgBox "There was a problem opening " & sXLFileToOpen & "!" End Sub -- Garry Free usenet access at [URL]http://www.eternal-september.org[/URL] Classic VB Users Regroup! comp.lang.basic.visual.misc microsoft.public.vb.general.discussion [/QUOTE]
Verification
Post reply
Forums
Archive
Newsgroup Archive
Excel Newsgroups
Excel Misc
Opening excel 2010 spreadsheet from Access
Top