Solved

Problem starting Excel template from Access

Posted on 2014-09-24
3
237 Views
Last Modified: 2014-09-25
Hi

I have created an Excel (2013) template with quite a bit of VBA code inside, and it works perfectly.

When I start the template with a double click, it creates a new Excel file (of type .xlsm) as expected. So far, so good.

Now I want to start the Excel template from a "switchboard" Access (2013) app, which doesn't sound hard, as I already start loads of other apps (not only Access) with that switchboard app. In the latter I tried using the 2 methods which I already use for all other apps / files:
- either VBA's Hyperlink (first define the link as <path and name of the Excel.xltm file> and then Hyperlink.Follow)
- or the Shell function like this n = Shell(<Excel.exe path and name> """<path and name of the Excel.xltm file>"""

However, when I use either of these 2 methods, the Excel template ITSELF opens, it does NOT create a new Excel file. What shall I do or modify in the above to have the Excel template to create a new Excel file ?

Thanks for help
Bernard
0
Comment
Question by:bthouin
  • 2
3 Comments
 
LVL 84

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 500 total points
ID: 40341934
I believe you have to use Automation to handle this, something like:

Dim xl As Object
Set xl = CreateObject("Excel.Application")
Dim wb As Object
Set wb = xl.Workbooks.Add(Template:="Path to your template"
0
 
LVL 1

Author Comment

by:bthouin
ID: 40343478
Hi Scott

This starts Excel (I can see it appearing in the Task Manager), but Excel is not visible, so something is missing.
0
 
LVL 1

Author Comment

by:bthouin
ID: 40343509
Sorry, found it: make Excel app visible...

Thanks Scott, you get the points.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Workbook link problems after copying tabs to a new workbook? David Miller (dlmille) Intro Have you either copied sheets to a new workbook, and after having saved and opened that workbook, you find that there are links back to the original sou…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now