?
Solved

Embed reference solver file into macro workbook

Posted on 2016-08-05
2
Medium Priority
?
54 Views
Last Modified: 2016-09-03
I have a user that has a macro enabled excel sheet that runs some calculations. It would not run on his computer because he was missing a reference file. The user is running Office 2013, but the macro was looking for a file in the "Office14" folder.

I ran into an issue like this before and had the file on my computer already
"C:\Program Files (x86)\Microsoft Office\Office14\Library\SOLVER\SOLVER.XLAM"

The issue now, is anyone he sends this file to that does not have this filepath cannot run the macro.  I would have to set it up for them each time. Is there a way to embed it into the worksheet so I dont have to remote into a pc and add this path every time someone else uses it? I tried saving in another format, but it would only allow me to save as a .xlsm since it has the macro.
0
Comment
Question by:transystems
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 52

Accepted Solution

by:
Rgonzo1971 earned 2000 total points
ID: 41745969
Hi,

pls try to add this code to test or add the reference to the solver
Sub Macro()
strFilename = CreateObject("wscript.shell").exec("cmd /c Dir """ & Application.Path & "\solver.xla*"" /s /b").StdOut.ReadLine
If strFilename <> "" Then
    For Each AiItem In AddIns
        If AiItem.FullName = strFilename Then
            'Debug.print "Found Solver"
            AiItem.Installed = True
            Exit Sub
        End If
    Next
    'not referenced yet
    AddIns.Add(strFilename).Installed = True
Else
    MsgBox "no Solver found"
End If

End Sub

Open in new window

Regards
0
 
LVL 14

Expert Comment

by:frankhelk
ID: 41782764
No comment has been added to this question in more than 21 days, so it is now classified as abandoned.

I have recommended this question be closed as follows:

Accept: Rgonzo1971 (https:#a41745969)

If you feel this question should be closed differently, post an objection and the moderators will review all objections and close it as they feel fit. If no one objects, this question will be closed automatically the way described above.

frankhelk
Experts-Exchange Cleanup Volunteer
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
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 …

770 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