Hello,
I am a new user on this forum so this is pretty new to me. I'm trying to open a specific Excel Spreadsheet from an Access Form and am experiencing problems doing so.
If anyone can help me with the code I would be most grateful
Thank you,
Adi
PWNettle
03-30-2001, 08:55 AM
If all you want to do is display an excel file you could use the ShellExecute API call. In the general declarations section of your form put this:
<PRE> Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long</PRE>and in your button you'd do something like this:
<PRE> Private Sub Command0_Click()
Dim lngResult As Long
Dim strDocument As String
' Change the path below to something appropriate for you.
strDocument = "e:\development\test.xls"
lngResult = ShellExecute(Me.hwnd, "Open", strDocument, "", "", vbNormalFocus)
End Sub</PRE>If you actually want to open an excel file and manipulate it'd help if you are more specific about what you want to do.
Hope this helps,
Paul
It worked!
Thank you thank you THANK YOU.