Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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. |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
opening same excel file at different computers in real time | Excel Discussion (Misc queries) | |||
Why doesn't my file open in other computers? | Excel Discussion (Misc queries) | |||
Same file & printer, different computers & results | Excel Discussion (Misc queries) | |||
Editing the same file from two computers at the same time | Setting up and Configuration of Excel | |||
Data Entry in the same file by 2 computers | Excel Programming |