Wrox Programmer Forums
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 16th, 2006, 09:19 AM
Registered User
 
Join Date: Nov 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Opening Excel

Hi,

I have written an Access form that went a command button is clicked, will open a link to an Excel workbook then append data into it and then close the link. The problem I have is that I cant get access to open up the workbook afterwards. I have checked the references and they are set correctly. I can open the workbook by minimising access then double clicking the file, but just cant get access to open it for me.

Any Ideas????

 
Old November 21st, 2006, 03:26 PM
Authorized User
 
Join Date: Nov 2006
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Why are you wanting to open an Excel spreadsheet via Access after you update it?

Just curious.

John

 
Old November 22nd, 2006, 12:28 AM
Authorized User
 
Join Date: Nov 2006
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
Default

why not just leave it open after you update it, since you are trying to open it again after that anyways? Or perhaps create a new instance of excel instead of updating???
 
Old November 26th, 2006, 02:41 PM
Registered User
 
Join Date: Nov 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I dont actually open the spreadsheet, just link to it to update the information automatically from information stored in a table. I need to preview the spreadsheet before saving it under a different name. I have no problems updating it, but I just cant get it to open from access although I can open it manually.

 
Old November 28th, 2006, 11:33 PM
Authorized User
 
Join Date: Nov 2006
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Have you tried using the shell command?
I read someone here was using the shell command to open documents, I also have some sample code somewhere that makes an api call but you should try goofing around with the shell command some, if that doesnt work I have an api call that i know works because Ive used it to open word documents...

this is where I found some code:

http://msdn2.microsoft.com/en-us/library/xe736fyk(VS.80).aspx

Public Function Shell( _
ByVal PathName As String, _
Optional ByVal Style As AppWinStyle = AppWinStyle.MinimizedFocus, _
Optional ByVal Wait As Boolean = False, _
Optional ByVal Timeout As Integer = -1 _
) As Integer

and


http://p2p.wrox.com/topic.asp?TOPIC_...rchTerms=shell


Private Sub cmdNorthwind_Click()
Dim dq As String
Dim strExe As String
Dim strMdb As String
Dim strRun As String
Dim dblReturnVal As Double

dq = """"

'Define var strExe; Miscosoft Access
strExe = "C:\Program Files\Microsoft Office\OFFICE11\MSACCESS.EXE"

'Define var strMdb; Project database location
strMdb = "D:\Daniel\Databases\Northwind.mdb"

'Define the entire statement to implement at Shell
strRun = dq & strExe & dq & " " & dq & strMdb & dq

'Run the code to open the project database
dblReturnVal = Shell(strRun, vbMaximizedFocus)

End Sub


if you have trouble with the shell command send me an email and ill send you the code for an api call todo the same thing that I know works

[email protected]





Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem in opening excel file in MS Excel 2000 kallol Visual C++ 0 November 16th, 2007 05:48 AM
Opening Excel file p2pMember ASP.NET 1.0 and 1.1 Professional 1 January 21st, 2006 01:54 PM
Opening Excel and Excel files dinosaur_uk VB.NET 2002/2003 Basics 3 September 17th, 2004 03:22 AM
Opening Excel from Access Sach Access 3 June 22nd, 2004 10:34 AM
Opening excel worksheet in c# GanpatDSouza C# 1 January 23rd, 2004 03:53 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.