Solved

Embed reference solver file into macro workbook

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

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Workbook link problems after copying tabs to a new workbook? David Miller (dlmille) Intro Have you either copied sheets to a new workbook, and after having saved and opened that workbook, you find that there are links back to the original sou…
Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
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 …
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.

863 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

27 Experts available now in Live!

Get 1:1 Help Now