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.
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.
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.