ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Active directory (https://www.excelbanter.com/excel-programming/430317-active-directory.html)

David

Active directory
 

Hi Group,

How do ID the directory that the active file is in with code?

Thanks,
David

Per Jessen

Active directory
 

Hi

Try this:

CurrentPath = ActiveWorkbook.Path

Regards,
Per

"David" skrev i meddelelsen
...
Hi Group,

How do ID the directory that the active file is in with code?

Thanks,
David



David

Active directory
 

Hello Per,

I thought all I needed was what you provided to do what I wanted to do,
which is to open all the files in the current directory. This is what I was
hoping would work, but it is not:

Sub OpenAllFiles()
'David Lanman 5/2/2009
Dim strFile
Dim strFolder
strFolder = ActiveWorkbook.Path
strFolderSave = ActiveWorkbook.Path
strFile = Dir(strFolder & "*.*", vbNormal)
Do While strFile < ""
MsgBox strFile
Workbooks.Open Filename:= _
strFolder & strFile
'do something
ActiveWorkbook.SaveAs Filename:= _
strFolderSave & "/" & strFile
ActiveWorkbook.Close
strFile = Dir
Loop
End Sub

The strFile is empty. There is extra code, in that when I save it will be to
the same directory.

Thanks for your help,
David

"Per Jessen" wrote:

Hi

Try this:

CurrentPath = ActiveWorkbook.Path

Regards,
Per

"David" skrev i meddelelsen
...
Hi Group,

How do ID the directory that the active file is in with code?

Thanks,
David




David

Active directory
 

Figured it out. Thanks


"Per Jessen" wrote:

Hi

Try this:

CurrentPath = ActiveWorkbook.Path

Regards,
Per

"David" skrev i meddelelsen
...
Hi Group,

How do ID the directory that the active file is in with code?

Thanks,
David





All times are GMT +1. The time now is 11:51 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com