Learn Excel =INFO("Directory") to find - Podcast 1876

If you like this content, please consider visiting the video on YouTube and subscribe to the MrExcel Channel to show your support!
This video has been published on Apr 9, 2014.
You want to use some VBA to save a file to the desktop. But what is the real path to the desktop? It is not C:\Desktop\. In this episode, an arcane function = INFO to return the path of the current workbook.
maxresdefault.jpg


Transcript of the video:
The MrExcel podcast is sponsored by Easy-XL.
Learn excel from MrExcel podcast. Episode # 1876 What Is the name of the Desktop folder?=INFO() Hey welcome back to the MrExcel netcast.
I'm Bill Jelen.
Today a question posted this morning at YouTube on one of my old videos podcast 1505.
They're trying to modify the code and saying that the ActiveWorkbook.SaveAs is returning an error.
Well it's not the ActiveWorkbook.SaveAs I can recognize right away that we are missing the closing backslash there.
But I think there's a bigger problem unless they've specifically created a folder called C:\Desktop That's not the right path your real desktop is stored in some other path and you know so I'm trying to figure out how to explain this on YouTube. How to figure out what the real path name is and it's a little frustrating up here in Windows Explorer, you know they they have this nice a little you know, I don't even know what to call it.
But if you click out here it gives you the real path - the the closing \ but for the Desktop if you click on Desktop you see, even if you click in there it doesn't give you anything more than Desktop.
What is the real name to that path the desktop path, So here's my idea, just take any file. I don't care what it is just put something in the file and do File, Save As.
Save to the Desktop Just call it anything it doesn't really matter.
Okay, now that that's saved into the folder that we're interested in we can ask for =INFO returns information about the current operating environment, this is one of those just arcane arcane things that's just left over from a long long time ago and we asked for the directory and see there it gives us the actual path alright.
So I'll copy that convert it to values and then that's the text that you would want to put in your code up here instead of just pointing to Desktop although it looks like they're using invoices after that, so something along those lines would be the correct code, so there you go. Just an interesting way to use this arcane =INFO function to figure out the real name, the real name of any given directory or folder. It shouldn't be that hard to figure out what your Desktop directory is and maybe some people memorize the users and your user name but I don't. You know I had to use this trick so there you go.
A cool little trick with the INFO function alright.
Hey, I want to thank for stopping by. Will see you next time for another netcast from MrExcel.
 

Forum statistics

Threads
1,213,532
Messages
6,114,176
Members
448,554
Latest member
Gleisner2

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