Solved

Embed reference solver file into macro workbook

Posted on 2016-08-05
2
24 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
2 Comments
 
LVL 48

Accepted Solution

by:
Rgonzo1971 earned 500 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 13

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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Approximate matching with VLOOKUP and MATCH seems to me to be a greatly under-used technique, and one which is vital for getting good performance out of large lookups. Until recently I would always have advised using an exact match for simplicity an…
Convert between Excel file formats (.XLS, .XLSX, .XLSM) with/without macro option David Miller (dlmille) Intro Over this past Fall, I've had the opportunity to see several similar requests and have developed a couple related solutions associate…
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…
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…

708 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

20 Experts available now in Live!

Get 1:1 Help Now