Embed a .txt file in Excel Workbook for dynamicMenu getContent?

VBE313

Well-known Member
Joined
Mar 22, 2019
Messages
686
Office Version
  1. 365
Platform
  1. Windows
I have a custom ribbon in this Excel file, and below is a group in my manifest.xml file. I have the the getContent going to a macro called "RDBdynamicMenuContent2." Is there a way to embed MYPath file path into this workbook? Instead of reading the Contacts.txt file from this J drive, can I embed this file like a Manifest.xml file?

VBA Code:
Public Sub RDBdynamicMenuContent2(control As IRibbonControl, ByRef returnedVal)
    Dim MYPath As String
    Dim xml As String
  [B]  MYPath = "J:\Industries\1126\Bad files\BOM\RMFGContacts.txt"[/B]
    xml = LoadTextFile(MYPath)
    returnedVal = xml
    On Error Resume Next
    rib.InvalidateControl ("RDBDynamicMenu")
End Sub


XML:
   <group id="PeopleButtons" label="To/From" >
        <dynamicMenu id="RDBDynamicMenu" getContent="RDBdynamicMenuContent2" imageMso="AddUserToPermissionGroup" label="Choose Author and Customer" size="large" supertip="Auto-populate the Author and Internal Customer" />
   </group>
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
Depends on your needs I guess, you can "embed" the xml as a string constant in your VBA:

VBA Code:
Const RibbonX as String = "<group id=""PeopleButtons"" label=""To/From"" ><dynamicMenu id=""RDBDynamicMenu"" getContent=""RDBdynamicMenuContent2"" imageMso=""AddUserToPermissionGroup"" label=""Choose Author and Customer"" size=""large"" supertip=""Auto-populate the Author and Internal Customer"" /></group>"
 
Upvote 0
Hi Mr. Pieterse,

Thanks for the response. The reason why I want to "embed" it, is because not all the users have access to that part of the J Drive. I just want the dynamic menu to be used without referencing that .txt file.
I am brand new with string constants. Does the string constant need to be in the same module as the sub procedure? Also, do i change anything in the manifest? Thank you!

P.S.

I love your website and you have helped me with so many things throughout my project (last 14 months). Thank you very much for all the content you post!
 
Upvote 0
Hmm, given that this is fixed, why not put it in the RibbonX inside the file directly?
The Manifest.xml file is not what I need to be in the file. I already have the manifest.xml. The actual data that makes up the dynamicMenu is what I need to embed into the file. So my manifest.xml file uses the getContent"RDBdynamicMenuContent2" which then calls this .txt file(see photo) to create my dynamicMenu.
 

Attachments

  • .txt..png
    .txt..png
    13.6 KB · Views: 8
Upvote 0
I'm sorry, I don't understand. Can you please try to explain in different wording, what it is you are trying to achieve?
 
Upvote 0

Forum statistics

Threads
1,214,641
Messages
6,120,693
Members
448,979
Latest member
DET4492

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top