ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   path of workbook (https://www.excelbanter.com/excel-programming/295291-path-workbook.html)

fabalicious[_8_]

path of workbook
 
With

ActiveWorkbook.FullName

i can get the full path of my active workbook. Using .Name instead onl
the file name. how can i get ONLY the path without the filename?

is there a predefined function for it? if not, has anyone any idea ho
to chop of the last bit ("/filename.xls")?

Come on, big props to the one sweetening my weekend by giving me th
illusion of having solved everything i need for my macro...
(it's 15:30 here already ;-))

Fabaliciou

--
Message posted from http://www.ExcelForum.com


Fraggs[_10_]

path of workbook
 
if you use the web toolbar you can navigate to where you want to go
navigate to a file in the folder you want to open then before you clic
ok to go to it, get rid of the file name and you have a neat link to
folder. Then just copy it into your macro or do whateva you see fit t
it

--
Message posted from http://www.ExcelForum.com


kkknie[_45_]

path of workbook
 
ActiveWorkbook.Path



--
Message posted from http://www.ExcelForum.com


Don Guillett[_4_]

path of workbook
 
try
activeworkbook.path

Here is a backup file I use to backup to the current directory.

Sub Backup() 'kept in personal.xls & assigned to toolbar button
On Error GoTo BackupFile
MkDir CurDir & "\Backup"
BackupFile:
With ActiveWorkbook
MyWB = .Path & "\BACKUP\" & .Name
.SaveCopyAs MyWB
.Save
End With
End Sub
--
Don Guillett
SalesAid Software

"fabalicious " wrote in message
...
With

ActiveWorkbook.FullName

i can get the full path of my active workbook. Using .Name instead only
the file name. how can i get ONLY the path without the filename?

is there a predefined function for it? if not, has anyone any idea how
to chop of the last bit ("/filename.xls")?

Come on, big props to the one sweetening my weekend by giving me the
illusion of having solved everything i need for my macro...
(it's 15:30 here already ;-))

Fabalicious


---
Message posted from
http://www.ExcelForum.com/




Michel Pierron[_2_]

path of workbook
 
Hi fabalicious;
ActiveWorkbook.Path
MP

"fabalicious " a écrit dans le
message de ...
With

ActiveWorkbook.FullName

i can get the full path of my active workbook. Using .Name instead only
the file name. how can i get ONLY the path without the filename?

is there a predefined function for it? if not, has anyone any idea how
to chop of the last bit ("/filename.xls")?

Come on, big props to the one sweetening my weekend by giving me the
illusion of having solved everything i need for my macro...
(it's 15:30 here already ;-))

Fabalicious


---
Message posted from http://www.ExcelForum.com/




fabalicious[_9_]

path of workbook
 
.Path

as simple as that! Suspected that but didn't work when I tried it out
There must have been another mistake...

Cheers

F

--
Message posted from http://www.ExcelForum.com


JMay

path of workbook
 
Don:
Thanks for the code. It works great.
Question however..
Users tend to forget to Run the macro before closing,
so quickly I thought of adding your Sub Backup() in the
Workbook BeforeClose as a one-liner, which works fine:

Only thing though is when you open the Backed-up file in the Backup folder
and then close it the code runs creating an error, since it is trying again
to backup the backup. I'm at the place of a dog chasing his tail on this.
Could you assist me?? I'm getting dizzy..
Thanks in advance.
JMay


"Don Guillett" wrote in message
...
try
activeworkbook.path

Here is a backup file I use to backup to the current directory.

Sub Backup() 'kept in personal.xls & assigned to toolbar button
On Error GoTo BackupFile
MkDir CurDir & "\Backup"
BackupFile:
With ActiveWorkbook
MyWB = .Path & "\BACKUP\" & .Name
.SaveCopyAs MyWB
.Save
End With
End Sub
--
Don Guillett
SalesAid Software

"fabalicious " wrote in

message
...
With

ActiveWorkbook.FullName

i can get the full path of my active workbook. Using .Name instead only
the file name. how can i get ONLY the path without the filename?

is there a predefined function for it? if not, has anyone any idea how
to chop of the last bit ("/filename.xls")?

Come on, big props to the one sweetening my weekend by giving me the
illusion of having solved everything i need for my macro...
(it's 15:30 here already ;-))

Fabalicious


---
Message posted from
http://www.ExcelForum.com/






Don Guillett[_4_]

path of workbook
 
Haven't thought about it but try

on error exit sub


--
Don Guillett
SalesAid Software

"JMay" wrote in message
news:IhTfc.25462$XP2.687@lakeread06...
Don:
Thanks for the code. It works great.
Question however..
Users tend to forget to Run the macro before closing,
so quickly I thought of adding your Sub Backup() in the
Workbook BeforeClose as a one-liner, which works fine:

Only thing though is when you open the Backed-up file in the Backup folder
and then close it the code runs creating an error, since it is trying

again
to backup the backup. I'm at the place of a dog chasing his tail on this.
Could you assist me?? I'm getting dizzy..
Thanks in advance.
JMay


"Don Guillett" wrote in message
...
try
activeworkbook.path

Here is a backup file I use to backup to the current directory.

Sub Backup() 'kept in personal.xls & assigned to toolbar button
On Error GoTo BackupFile
MkDir CurDir & "\Backup"
BackupFile:
With ActiveWorkbook
MyWB = .Path & "\BACKUP\" & .Name
.SaveCopyAs MyWB
.Save
End With
End Sub
--
Don Guillett
SalesAid Software

"fabalicious " wrote in

message
...
With

ActiveWorkbook.FullName

i can get the full path of my active workbook. Using .Name instead

only
the file name. how can i get ONLY the path without the filename?

is there a predefined function for it? if not, has anyone any idea how
to chop of the last bit ("/filename.xls")?

Come on, big props to the one sweetening my weekend by giving me the
illusion of having solved everything i need for my macro...
(it's 15:30 here already ;-))

Fabalicious


---
Message posted from
http://www.ExcelForum.com/








JMay

path of workbook
 
Thanks, will do.

"Don Guillett" wrote in message
...
Haven't thought about it but try

on error exit sub


--
Don Guillett
SalesAid Software

"JMay" wrote in message
news:IhTfc.25462$XP2.687@lakeread06...
Don:
Thanks for the code. It works great.
Question however..
Users tend to forget to Run the macro before closing,
so quickly I thought of adding your Sub Backup() in the
Workbook BeforeClose as a one-liner, which works fine:

Only thing though is when you open the Backed-up file in the Backup

folder
and then close it the code runs creating an error, since it is trying

again
to backup the backup. I'm at the place of a dog chasing his tail on

this.
Could you assist me?? I'm getting dizzy..
Thanks in advance.
JMay


"Don Guillett" wrote in message
...
try
activeworkbook.path

Here is a backup file I use to backup to the current directory.

Sub Backup() 'kept in personal.xls & assigned to toolbar button
On Error GoTo BackupFile
MkDir CurDir & "\Backup"
BackupFile:
With ActiveWorkbook
MyWB = .Path & "\BACKUP\" & .Name
.SaveCopyAs MyWB
.Save
End With
End Sub
--
Don Guillett
SalesAid Software

"fabalicious " wrote in

message
...
With

ActiveWorkbook.FullName

i can get the full path of my active workbook. Using .Name instead

only
the file name. how can i get ONLY the path without the filename?

is there a predefined function for it? if not, has anyone any idea

how
to chop of the last bit ("/filename.xls")?

Come on, big props to the one sweetening my weekend by giving me the
illusion of having solved everything i need for my macro...
(it's 15:30 here already ;-))

Fabalicious


---
Message posted from
http://www.ExcelForum.com/











All times are GMT +1. The time now is 12:07 PM.

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