![]() |
how to save file on different computers
Hello,
I'm just finishing up programming my file and i'm stuck. I need to automatically save this file on Desktop for example but it will be used on different computers. Directory names will be different. They are all running windows OS. For example: c:\Documents and settings\User name\Desktop "User name" folder will be different on every computer. Is there any way to point my code to save in "Desktop" folder directly? Thanks for your help. |
how to save file on different computers
I don't like saving things to the desktop but there are times when it makes
sense. The following lines will give you the path to the desktop on whatever PC the code is being run. Const Desktop = &H10& Set objShell = CreateObject("Shell.Application") Set objFldrDesk = objShell.Namespace(Desktop) strDeskPath = objFldrDesk.Self.Path & "\" Steve Yandl "Graff" wrote in message ... Hello, I'm just finishing up programming my file and i'm stuck. I need to automatically save this file on Desktop for example but it will be used on different computers. Directory names will be different. They are all running windows OS. For example: c:\Documents and settings\User name\Desktop "User name" folder will be different on every computer. Is there any way to point my code to save in "Desktop" folder directly? Thanks for your help. |
how to save file on different computers
Thanks for your help Steve.
Everything works as it should. I just had to replace strDeskPath with SPath, so the result looks something like: ActiveWorkbook.SaveAs Filename:=SPath & mon.Range("A101").Value & " Daily " & Format(sun.Range("A1").Value, "mm-dd-yy") & ".xls" There's something else that bothers me with the auto save procedure. Say you are saving a file with a name that already exists, it will ask you to overwrite. You say yes, it overwrites, you say no, it will give you a run time error. I just started working with VB so i'm not that great at it yet. Although a chance of this scenario taking place is zero, i'd like to have something done with the code to overcome this bug. Any ideas on that? Thanks again for your help, "Steve Yandl" wrote: I don't like saving things to the desktop but there are times when it makes sense. The following lines will give you the path to the desktop on whatever PC the code is being run. Const Desktop = &H10& Set objShell = CreateObject("Shell.Application") Set objFldrDesk = objShell.Namespace(Desktop) strDeskPath = objFldrDesk.Self.Path & "\" Steve Yandl "Graff" wrote in message ... Hello, I'm just finishing up programming my file and i'm stuck. I need to automatically save this file on Desktop for example but it will be used on different computers. Directory names will be different. They are all running windows OS. For example: c:\Documents and settings\User name\Desktop "User name" folder will be different on every computer. Is there any way to point my code to save in "Desktop" folder directly? Thanks for your help. |
All times are GMT +1. The time now is 05:25 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com