Solved

Problem starting Excel template from Access

Posted on 2014-09-24
3
244 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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

776 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