• 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
  • Blog
  • Excel Webinars
  • Excel Forum
    • Register as Forum Member
  • Login

VBA to navigate to SharePoint files|VBA & Macros|Excel Forum|My Online Training Hub

You are here: Home / VBA to navigate to SharePoint files|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 & MacrosVBA to navigate to SharePoint files
sp_PrintTopic sp_TopicIcon
VBA to navigate to SharePoint files
Avatar
Graham Stent
Member
Members
Level 0
Forum Posts: 17
Member Since:
November 3, 2015
sp_UserOfflineSmall Offline
1
September 16, 2022 - 1:25 am
sp_Permalink sp_Print

Hi there,

I'm all Googled out and cannot find a solution to my problem. The scenario is that I have a cell on a sheet that my users can double click on and using the Application.GetOpenFilename dialog box they can choose their latest months source file before running their process. This has been working absolutely fine whilst we have been on FileShares but now we are moving over to SharePoint the Application.GetOpenFilename dialog box does not have an option to navigate to a SharePoint location to choose a file. I know in Excel if I go through the Menu option "File; Open" then I get an option to navigate to "Sites" but I cannot work out how to get to this feature using VBA ....... any prompts or help very much appreciated.

Thanks

Graham

sp_AnswersTopicSeeAnswer See Answer
Avatar
Velouria
London or thereabouts
Moderator
Members


Trusted Members

Moderators
Level 4
Forum Posts: 689
Member Since:
November 1, 2018
sp_UserOfflineSmall Offline
2
September 20, 2022 - 8:15 pm
sp_Permalink sp_Print

Do you actually open the file they choose after they select it in the dialog, or do you just need the path? Automating the backstage view (File - Open) would actually open it.

Avatar
Graham Stent
Member
Members
Level 0
Forum Posts: 17
Member Since:
November 3, 2015
sp_UserOfflineSmall Offline
3
September 23, 2022 - 10:54 pm
sp_Permalink sp_Print

Hi - I am just trying to get the path ......

Avatar
Velouria
London or thereabouts
Moderator
Members


Trusted Members

Moderators
Level 4
Forum Posts: 689
Member Since:
November 1, 2018
sp_UserOfflineSmall Offline
4
September 24, 2022 - 12:15 am
sp_Permalink sp_Print

You should be able to use something like this, specifying the relevant SP path in the InitialFileName property:

 

With Application.FileDialog(msoFileDialogOpen)
.InitialFileName = "https://somesite.sharepoint.com/yourfolder/"
.AllowMultiSelect = False
.Show
For Each vrtSelectedItem In .SelectedItems
Debug.Print vrtSelectedItem ' adjust this to do whatever you need
Next
End With

Avatar
Graham Stent
Member
Members
Level 0
Forum Posts: 17
Member Since:
November 3, 2015
sp_UserOfflineSmall Offline
5
October 5, 2022 - 12:55 am
sp_Permalink sp_Print

Thanks for the reply Velouria ...... that works to a point but what I am really trying to work out is a way for the user to navigate to their SharePoint site without it being pre-defined in anyway in the code.  The same as you can if you just go to File; Open in Excel and you have an option to navigate to SharePoint sites (it's about the 5th option down directly below the word "Open"). I'm beginning to think that this isn't supported in VBA ......

Avatar
Velouria
London or thereabouts
Moderator
Members


Trusted Members

Moderators
Level 4
Forum Posts: 689
Member Since:
November 1, 2018
sp_UserOfflineSmall Offline
6
October 5, 2022 - 6:25 pm
sp_Permalink sp_Print

Unfortunately I don't think the exact thing you are looking for is possible with VBA. The only place the Sites appear is in Backstage view, not in any of the Open dialogs. I'll do a bit more looking but I wouldn't hold your breath... 😉

Avatar
Graham Stent
Member
Members
Level 0
Forum Posts: 17
Member Since:
November 3, 2015
sp_UserOfflineSmall Offline
7
October 6, 2022 - 11:58 pm
sp_Permalink sp_Print

Hi Velouria,

I've managed to get a solution working using your code. As long as the main workbook is saved on the SharePoint site this will allow the user to navigate to their source file on the same SharePoint site:

With Application.FileDialog(msoFileDialogOpen)
.InitialFileName = ThisWorkbook.Path
.AllowMultiSelect = False
.Show
For Each vrtSelectedItem In .SelectedItems
Debug.Print vrtSelectedItem ' adjust this to do whatever you need
Next
End With

Thank you so much for your help

sp_AnswersTopicAnswer
Answers Post
sp_Feed
Go to top
Forum Timezone: Australia/Brisbane
Most Users Ever Online: 245
Currently Online: Edson Lima, Peter Venkatrao, Ted Eggleston, Ronald White
Guest(s) 10
Currently Browsing this Page:
1 Guest(s)
Top Posters:
SunnyKow: 1432
Anders Sehlstedt: 880
Purfleet: 414
Frans Visser: 346
David_Ng: 306
lea cohen: 237
Jessica Stewart: 219
A.Maurizio: 213
Aye Mu: 201
Hans Hallebeek: 185
Newest Members:
thong nguyen
Appiagyei Kofi Frimpong
Hilary Burchfield
Richie Wright
Adel Kock
Barbara Murray
Doug Milne
Siobhan Stringer
Rob Rooth
Tom Lewis
Forum Stats:
Groups: 3
Forums: 24
Topics: 6542
Posts: 28644

 

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

Sidebar

Blog Categories

  • Excel
  • Excel Charts
  • Excel Dashboard
  • Excel Formulas
  • Excel Office Scripts
  • 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

Sign up to our newsletter and join over 400,000
others who learn Excel and Power BI with us.

 

Company

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

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.