Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > VBA / Office Integration > Word, PowerPoint, Outlook, and Other Office Products > Open file


Reply
 
Thread Tools Display Modes
  #1  
Old 03-29-2001, 08:23 AM
Adi
Guest
 
Posts: n/a
Question Open file


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

Reply With Quote
  #2  
Old 03-30-2001, 09:55 AM
PWNettle PWNettle is offline
Verbose Coder

Retired Moderator
* Guru *
 
Join Date: Dec 1999
Location: Phoenix, Arizona
Posts: 3,011
Default Re: Open file

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



Reply With Quote
  #3  
Old 03-30-2001, 10:49 AM
Adi
Guest
 
Posts: n/a
Smile Re: Open file

It worked!

Thank you thank you THANK YOU.

Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->