VBA File Path question

mayoung

Active Member
Joined
Mar 26, 2014
Messages
259
Office Version
  1. 365
Platform
  1. Windows
  2. Mobile
I am creating a custom addin that takes reports that have been down loaded out of our business System and then through VBA uploads the data into excel.
The downloaded report out our business system goes into a download file on our computer.,
The file path would be: C:\User\ myoung\dowloads. The myoung would be the persons computer this particular file path is for. But several people want this addin in on there computer in excel. My question is, is there away to make a path so the VBA gets to the download folder of the persons which the addin is installed on or does each different file path have to be set up? Or is there a work around for this?
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
Another option
VBA Code:
MyPath=environ("Userprofile")&"\Downloads\"
 
Upvote 0
Another option
VBA Code:
MyPath=environ("Userprofile")&"\Downloads\"

How Do I get the Path & MyPath Code to open the DataminerFile.xml?

The only code I can get to work is the first one Workbooks.Open

VBA Code:
Workbooks.Open ("C:\Users\myoung\OneDrive - Bobs Enterprises Inc\Downloads\DataminerFile.xml")
 
Path = "C:\Users\" & Environ("username") & "\OneDrive - Bobs Enterprises Inc\Downloads\DataminerFile.xml"
 
MyPath = Environ("userProfile") & "\OneDrive - Bobs Enterprises Inc\Downloads\Dataminer.xml"
 
Upvote 0
I have never used OneDrive or xml files, but you could try
VBA Code:
MyPath = Environ("userProfile") & "\OneDrive - Bobs Enterprises Inc\Downloads\Dataminer.xml"
Workbooks.Open MyPath
 
Upvote 0
I have never used OneDrive or xml files, but you could try
VBA Code:
MyPath = Environ("userProfile") & "\OneDrive - Bobs Enterprises Inc\Downloads\Dataminer.xml"
Workbooks.Open MyPath

That worked for Both lines of code. Thank You
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0
That's a totally different question, so needs a new thread. Thanks.
 
Upvote 0

Forum statistics

Threads
1,224,600
Messages
6,179,836
Members
452,947
Latest member
Gerry_F

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