• Skip to main content
  • Skip to header right navigation
  • Skip to site footer

My Online Training Hub

Learn Dashboards, Excel, Power BI, Power Query, Power Pivot

  • Courses
  • Pricing
    • Free Courses
    • Power BI Course
    • Excel Power Query Course
    • Power Pivot and DAX Course
    • Excel Dashboard Course
    • Excel PivotTable Course – Quick Start
    • Advanced Excel Formulas Course
    • Excel Expert Advanced Excel Training
    • Excel Tables Course
    • Excel, Word, Outlook
    • Financial Modelling Course
    • Excel PivotTable Course
    • Excel for Customer Service Professionals
    • Excel for Operations Management Course
    • Excel for Decision Making Under Uncertainty Course
    • Excel for Finance Course
    • Excel Analysis ToolPak Course
    • Multi-User Pricing
  • Resources
    • Free Downloads
    • Excel Functions Explained
    • Excel Formulas
    • Excel Add-ins
    • IF Function
      • Excel IF Statement Explained
      • Excel IF AND OR Functions
      • IF Formula Builder
    • Time & Dates in Excel
      • Excel Date & Time
      • Calculating Time in Excel
      • Excel Time Calculation Tricks
      • Excel Date and Time Formatting
    • Excel Keyboard Shortcuts
    • Excel Custom Number Format Guide
    • Pivot Tables Guide
    • VLOOKUP Guide
    • ALT Codes
    • Excel VBA & Macros
    • Excel User Forms
    • VBA String Functions
  • Members
    • Login
    • Password Reset
  • Blog
  • Excel Webinars
  • Excel Forum
    • Register as Forum Member

Custom UI DropDown select msoFileDialogOpen|VBA & Macros|Excel Forum|My Online Training Hub

You are here: Home / Custom UI DropDown select msoFileDialogOpen|VBA & Macros|Excel Forum|My Online Training Hub
Avatar
sp_LogInOut Log In sp_Registration Register
sp_Search Search
Advanced Search|Last Search Results
Search
Forum Scope




Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
sp_Search Search
sp_RankInfo
Lost password?
sp_CrumbsHome HomeExcel ForumVBA & MacrosCustom UI DropDown select msoFileDi…
sp_PrintTopic sp_TopicIcon
Custom UI DropDown select msoFileDialogOpen
Avatar
Steven Behr
Member
Members

Power Query
Level 0
Forum Posts: 85
Member Since:
January 30, 2020
sp_UserOfflineSmall Offline
1
October 13, 2021 - 12:49 pm
sp_Permalink sp_Print sp_EditHistory

Afternoon,

Im wondering, as I am a intermediate experienced custom UI programmer, I have been using the following code in my own database for a user to select a button on excel and choose a excel file from a folder using msoFileDialogOpen function.

Dim sFolder As String
Dim OpenBook As Workbook
' Open the select folder prompt
With Application.FileDialog(msoFileDialogOpen)
.InitialFileName = "H:\PROJECT-OPS\NSW Warehouse\NSWTA Inventory Listing"

I have got this sample workbook where on the ribbon "MY MACROS" and on the tile "Macro Lists" dropdown box Macro List 1 is taking the list data from name manager "MacroList' in the Admin TAB. (Highlighted in yellow). 

Is there a way in either custom UI or in Sub myMacroDD(ByVal control As IRibbonControl. to select the listed macro list 1 (in admin) tab copy that selected item from dropdown and paste it to a cell on the same tab

Thanks

 

Steve

sp_AnswersTopicSeeAnswer See Answer
Avatar
Steven Behr
Member
Members

Power Query
Level 0
Forum Posts: 85
Member Since:
January 30, 2020
sp_UserOfflineSmall Offline
2
October 15, 2021 - 11:11 am
sp_Permalink sp_Print

Just an update,

 

I just changed the following from .Value to .Copy

strMacro = ThisWorkbook.Names(strList) _
.RefersToRange.Rows(CLng(selectedIndex + 1)).Copy

Sheet1.Range("L3").PasteSpecial xlPasteValues
Application.CutCopyMode = False

 

Thanks

 

Steve

Avatar
Catalin Bombea
Iasi, Romania
Admin
Level 10
Forum Posts: 1810
Member Since:
November 8, 2013
sp_UserOfflineSmall Offline
3
October 15, 2021 - 2:55 pm
sp_Permalink sp_Print sp_EditHistory

To add a dynamic list in ribbon, you have to use the dynamicMenu element in UI xml, text file attached. you'll have to get the list of files and build the dynamic menu.

To loop through a folder to get the list of files, i guess you know how to do it, here is an example: https://www.mrexcel.com/board/.....a.1126467/

The other question is not clear, you mentioned that you want to get the value selected in the dropdown, but you already have the code:

strMacro = ThisWorkbook.Names(strList) _
.RefersToRange.Rows(CLng(selectedIndex + 1)).Value

sp_AnswersTopicAnswer
Answers Post
Avatar
Steven Behr
Member
Members

Power Query
Level 0
Forum Posts: 85
Member Since:
January 30, 2020
sp_UserOfflineSmall Offline
4
October 18, 2021 - 6:52 am
sp_Permalink sp_Print

Thanks Catalin for the advise , Ill have to study the zip file you gave me!.

In regards to your comment.

The .Value was a Application.Run (strMacro) that was taking the "value" of the name list of the 3 items (ToggleHeadings . Ect...). Once the dropdown was selected it was using that value to select the macro Sub ToggleHeadings().

I figured out, that if I used =IFERROR(@INDEX(GetFileNames($F$1),ROW()-6),"") in Cell F7 and using H:\PROJECT-OPS\NSW Warehouse\NSWTA Inventory Listing in cell F1 giving me the file names in that folder. I then use =IFERROR(LEFT(F7,FIND(".",F7)-1),"") in cell G7 giving the "actual" file name without the excel extension. This gives the dropdown listing the inventory listing. I COPY the selected item and paste this in Cell L3. I also have in M3 the excel file extension and in P1 the folder link. I then use in N3 =CONCATENATE(P1,L3,M3). giving H:\PROJECT-OPS\NSW Warehouse\NSWTA Inventory Listing\Budawang Inventory Listing.xlsx

I then use the following code to import the file selected

strMacro = ThisWorkbook.Names(strList) _
.RefersToRange.Rows(CLng(selectedIndex + 1)).Copy'.......COPY CELL SELECTED DROPDOWN

Sheet1.Range("L3").PasteSpecial xlPasteValues
Application.CutCopyMode = False
Application.ScreenUpdating = False

sFolder = Sheet1.Range("N3")'..................SELECT THIS FILE TO USE THIS FILE FROM FOLDER
Set OpenBook = Application.Workbooks.Open(sFolder)
OpenBook.Sheets(1).Range("A1:J" & Sheets("Sheet1").Range("A" & Rows.count).End(xlUp).Row).Copy ' ......COPY THIS FILE

ThisWorkbook.Worksheets("SiteFinder").Cells(Rows.count, "C").End(xlUp).Offset(3, 0).PasteSpecial xlPasteValues'....PASTE THIS COPY FILE AND PASTE IT IN THE FOLDER IN DATABASE
Range("A1").Select
Application.CutCopyMode = False
OpenBook.Close False
InsertTableArray1
Range("A1").Select
Application.ScreenUpdating = False

 

Might be a bit long but for the time it does work and I will get to your code laster today see how it works!.

 

Thanks

 

Steve

sp_Feed
Go to top
Forum Timezone: Australia/Brisbane
Most Users Ever Online: 245
Currently Online:
Guest(s) 9
Currently Browsing this Page:
1 Guest(s)
Top Posters:
SunnyKow: 1432
Anders Sehlstedt: 871
Purfleet: 412
Frans Visser: 346
David_Ng: 306
lea cohen: 219
Jessica Stewart: 205
A.Maurizio: 202
Aye Mu: 201
jaryszek: 183
Newest Members:
stuart burge
Bruce Tang Nian
Scot C
Othman AL MUTAIRI
Misael Gutierrez Sr.
Attif Ihsan
Kieran Fee
Murat Hasanoglu
Brett Dryland
Saeed Aldousari
Forum Stats:
Groups: 3
Forums: 24
Topics: 6223
Posts: 27295

 

Member Stats:
Guest Posters: 49
Members: 31920
Moderators: 3
Admins: 4
Administrators: Mynda Treacy, Philip Treacy, Catalin Bombea, FT
Moderators: MOTH Support, Velouria, Riny van Eekelen
© Simple:Press —sp_Information

Sidebar

Blog Categories

  • Excel
  • Excel Charts
  • Excel Dashboard
  • Excel Formulas
  • Excel PivotTables
  • Excel Shortcuts
  • Excel VBA
  • General Tips
  • Online Training
  • Outlook
  • Power Apps
  • Power Automate
  • Power BI
  • Power Pivot
  • Power Query
microsoft mvp logo
trustpilot excellent rating
Secured by Sucuri Badge
MyOnlineTrainingHub on YouTube Mynda Treacy on Linked In Mynda Treacy on Instagram Mynda Treacy on Twitter Mynda Treacy on Pinterest MyOnlineTrainingHub on Facebook
 

Company

  • About My Online Training Hub
  • Disclosure Statement
  • Frequently Asked Questions
  • Guarantee
  • Privacy Policy
  • Terms & Conditions
  • Testimonials
  • Become an Affiliate

Support

  • Contact
  • Forum
  • Helpdesk - For Technical Issues

Copyright © 2023 · My Online Training Hub · All Rights Reserved. Microsoft and the Microsoft Office logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries. Product names, logos, brands, and other trademarks featured or referred to within this website are the property of their respective trademark holders.