Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Back to Access Forum    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
Open Excel Spreadsheet help
Stanley Mc Keown 
     
2 years ago
I'm just a beginner with VBA but fairly familiar with access.

I want to open an excel spreadsheet specified in a field in an access form/table from a button on the form.

  The only successful attempt was when I used SHELL function but only successful when it was on the desktop. Put the excel file inside a folder and access can't find it.

  I've tried a few other methods but just get errors or can't be found.

  Can anyone help?
Sami Shamma  @Reply  
             
2 years ago
try this video
Follow Hyperlink
Alex Hedley  @Reply  
           
2 years ago
Were there spaces in the folder name?
Kevin Robertson  @Reply  
           
2 years ago
Tell us what you have tried and what the errors were.
Kevin Yip  @Reply  
     
2 years ago
To open a file, you need to reference the fully qualified path of the file.  E.g.:  D:\My Documents\Work\2024\Book1.xlsx  .  You need to store the full path somewhere in your database in order to do this.
Stanley Mc Keown OP  @Reply  
     
2 years ago
In one of Richards videos he'd rather you to not use Hyperlinks. Says they lead to trouble.
Stanley Mc Keown OP  @Reply  
     
2 years ago
I'll get the error messages for each of the ways I've tried. But I'll need to replicate what I'd done -- be back in a min.
Stanley Mc Keown OP  @Reply  
     
2 years ago
Now a forum question -- Can I quote each individual reply so I can reply directly to each post on this forum like you can with a phpBB forum for instance?
Alex Hedley  @Reply  
           
2 years ago
Nope
Kevin Robertson  @Reply  
           
2 years ago
With FollowHyperlink you are sending in the address as a string.

    FollowHyperlink Address As String [Then Some Optional Parameters]
Stanley Mc Keown OP  @Reply  
     
2 years ago
Ok Thanks Alex
Kevin here is the error i get using this code

Sub OpenProjectWorkbook()
'Opens an excel workbook'
Dim objExcel As Excel.Application
Dim objBook As Excel.Workbook
Dim objSheet As Excel.Worksheet
Dim objRange As Excel.Range
Dim intCol As Integer

  Set objExcel = CreateObject("Excel.Application")
  Set objBook = objExcel.Workbooks.Open("C:\Users\Owner\Desktop\CAL_DATE.xlsx")
   Set objSheet = objBook.Worksheets("Sheet1")
   For intCol = 1 To 3
   Set objRange = objSheet.Cells(1, intCol)
   Debug.Print objRange.Value
   Next
  
  
   Set objSheet = Nothing
   Set objExcel = Nothing
   Set objBook = Nothing
  
  
End Sub

----

The error dialogue box says

This file is not in a recognizable format

.If you know the file is from another program which is
incompatible with Microsoft Office Excel, clickCancel, then
open this file in its original application. If you want to open
the file later in Microsoft Office Excel, save it in a format that
is compatible, such as text format.
.If you suspect the file is damaged, click Help for more
information about solving the problem.
.If you still want to see what text is contained in the file, click
OK. Then click Finish in the Text Import Wizard.
Stanley Mc Keown OP  @Reply  
     
2 years ago
when i press OK and run debug it highlights

Set objSheet = objBook.Worksheets("Sheet1")
Stanley Mc Keown OP  @Reply  
     
2 years ago
I've referenced Microsoft Excel 12 object library
Stanley Mc Keown OP  @Reply  
     
2 years ago
I think Alex has solve why my SHELL function wouldn't work in the folder. I renamed the folder with an underscore and now the SHELL function works -- Thanks Alex
Stanley Mc Keown OP  @Reply  
     
2 years ago
Working my way through the Hyperlink video linked by Sami -- will check that and report back tomorrow Thanks all for now all -- got a way to go so don't go too far away -- I still need help ( well my workmates say that about me )

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Access Forum.
 

Next Unseen

 
New Feature: Comment Live View
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 5/6/2026 7:57:56 PM. PLT: 1s