Solved

Embed reference solver file into macro workbook

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

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

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

Suggested Solutions

Not long ago I saw a question in the VB Script forum that I thought would not take much time. You can read that question (Question ID  (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_28455246.html)28455246) Here (http…
Excel can be a tricky bit of software to get your head around. Whilst you’ll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to d…
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.

734 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