Solved

Embed reference solver file into macro workbook

Posted on 2016-08-05
2
46 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 51

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 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

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

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.
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

690 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