Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Knowing what Folder I'm in when I open from a shortcut

When I open an excel program from a shortcut, the Worksheet.Parent.Path
tells me the folder the workbook was opened from. How do I find out the
folder that the shortcut was in? It is this folder which shows when I do
"Open", so I'm assuming that it's kept somewhere. But I can't figure out
where.

Thanks,
Mac in Berkeley, CA


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,510
Default Knowing what Folder I'm in when I open from a shortcut

Hi Mac,

Am I interpreting your question correctly in assuming that you are referring
to a shortcut icon on your desktop? If so, the Desktop is actually a folder
which normally resides at C:\Documents and Settings\user name\Desktop
Where user name is whatever name has been used for each user.

Also if it is an icon on the desktop then right click on the icon and select
properties. Then select the General tab and you will see the path next to
Location: You might have to click on the actual location then use the arrow
keys to scroll across to read the full path.


--
Regards,

OssieMac


"Mac Lingo" wrote:

When I open an excel program from a shortcut, the Worksheet.Parent.Path
tells me the folder the workbook was opened from. How do I find out the
folder that the shortcut was in? It is this folder which shows when I do
"Open", so I'm assuming that it's kept somewhere. But I can't figure out
where.

Thanks,
Mac in Berkeley, CA



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Knowing what Folder I'm in when I open from a shortcut

OssieMac,

I start from a folder. I open an excel file from a shorcut (to another
folder), but I am still in the original folder I started in.


My question is how the in Excel VBA programming environment can I know what
folder I started the Excel program from (not the folder the excel program is
in).

Thanks,
Mac


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 434
Default Knowing what Folder I'm in when I open from a shortcut

hi, !

I start from a folder.
I open an excel file from a shorcut (to another folder)
but I am still in the original folder I started in.


at that moment, you know exactly which folder you are and/or
where is located the short-cut link-file to open your document/excel

My question is how the in Excel VBA programming environment can I know
what folder I started the Excel program from (not the folder the excel program is in).


suppose excel is closed, and suddenly it opens by means of... whatever, so...
how would excel be sure and tell you where you were while excel opens ?
- an hyperlink from another application (word, ppt, ...) ???
- a shorcut from your desktop ???
- a shortcut from windows-explorer or MyPC, or... ???

AFAIK, when excel opens from a shortcut, it's current directory is still the Application.DefaultFilePath

hth,
hector.


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,510
Default Knowing what Folder I'm in when I open from a shortcut

Still not sure that I fully understand what it is you want. The following
code out of help (slightly modified with the filespec) provides info about
the current workbook.

--
Regards,

OssieMac


"Héctor Miguel" wrote:

hi, !

I start from a folder.
I open an excel file from a shorcut (to another folder)
but I am still in the original folder I started in.


at that moment, you know exactly which folder you are and/or
where is located the short-cut link-file to open your document/excel

My question is how the in Excel VBA programming environment can I know
what folder I started the Excel program from (not the folder the excel program is in).


suppose excel is closed, and suddenly it opens by means of... whatever, so...
how would excel be sure and tell you where you were while excel opens ?
- an hyperlink from another application (word, ppt, ...) ???
- a shorcut from your desktop ???
- a shortcut from windows-explorer or MyPC, or... ???

AFAIK, when excel opens from a shortcut, it's current directory is still the Application.DefaultFilePath

hth,
hector.





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,510
Default Knowing what Folder I'm in when I open from a shortcut

I lost my last reply part way through so not sure if it posted but here it is
again because it was not all there.

I am still not sure exactly what it is you want but the following code out
of help (modified with the filespec) will give you the path of the workbook.

Sub ShowFileAccessInfo()
Dim filespec
Dim fs, d, f, s

filespec = ThisWorkbook.Name

Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFile(filespec)
s = UCase(f.Path) & vbCrLf
s = s & "Created: " & f.DateCreated & vbCrLf
s = s & "Last Accessed: " & f.DateLastAccessed & vbCrLf
s = s & "Last Modified: " & f.DateLastModified
MsgBox s, 0, "File Access Info"
End Sub

--
Regards,

OssieMac


"Héctor Miguel" wrote:

hi, !

I start from a folder.
I open an excel file from a shorcut (to another folder)
but I am still in the original folder I started in.


at that moment, you know exactly which folder you are and/or
where is located the short-cut link-file to open your document/excel

My question is how the in Excel VBA programming environment can I know
what folder I started the Excel program from (not the folder the excel program is in).


suppose excel is closed, and suddenly it opens by means of... whatever, so...
how would excel be sure and tell you where you were while excel opens ?
- an hyperlink from another application (word, ppt, ...) ???
- a shorcut from your desktop ???
- a shortcut from windows-explorer or MyPC, or... ???

AFAIK, when excel opens from a shortcut, it's current directory is still the Application.DefaultFilePath

hth,
hector.



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Knowing what Folder I'm in when I open from a shortcut

Thank you for trying. But...

When I open Excel from a shortcut, oncel Excel is running I know where its
file is from (Parent.Path). What I don't know once I'm inside the running
Excel program is the path to the folder I clicked on to start the program
(ie: the folder the shortcut was in). Is this information displayable
anywhere from inside the program?

Mac in Berkeley, CA


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
shortcut has change or move so this shortcut can not open bakerstreet Excel Worksheet Functions 2 April 2nd 10 01:21 PM
export data to an existing and open workbook without knowing the f vernington Excel Programming 8 June 28th 07 03:38 AM
User selection of folder and open all .xls files within folder Barb Reinhardt Excel Programming 4 April 14th 07 01:41 PM
Folder shortcut Daniel[_21_] Excel Programming 0 October 22nd 06 03:17 PM
Help: Can open a spreadsheet in a folder which contains spaces in the folder name! 1tsols Excel Programming 17 July 31st 06 04:26 PM


All times are GMT +1. The time now is 12:33 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"