VBA File Path question

mayoung

Active Member
Joined
Mar 26, 2014
Messages
257
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

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
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,214,415
Messages
6,119,381
Members
448,888
Latest member
Arle8907

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