Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
don don is offline
external usenet poster
 
Posts: 16
Default Finding out pathname

Hi I have a spreadsheet that uses a server path-name in a custom menu
link. I now have a process that backs the file up over our network
for other users to view. The problem being that these users view the
file on a different server and the link no longer works. I would
therefore like to be able to determine the location of the file, D:
or G: drive so I can set an alternate link up.

The current VBA is as below

Sub Link()
On Error Resume Next
Dim stFullName As String
Dim stFileName As String
Dim Wkb As Workbook
stFullName = Sheets("PathSheet").Range("E38")
stFileName = GetFileName(stFullName)
If IsWorkbookOpen(stFileName) Then
Set Wkb = Workbooks(stFileName)
Wkb.Activate
Else
Set Wkb = Workbooks.Open(Filename:=stFullName)
End If
End Sub

Any help would be great.

Don
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Finding out pathname

With ActiveWorkbook

ThisDrive = Left(.Path, InStr(":", .Path))
OtherDrive = IIf(ThisDrive = "D", "G", "D")
.Save
.SaveCopyAs Replace(.fullnmae, ThisDrive & ":", OtherDrive & ":")
End With


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"don" wrote in message
...
Hi I have a spreadsheet that uses a server path-name in a custom menu
link. I now have a process that backs the file up over our network
for other users to view. The problem being that these users view the
file on a different server and the link no longer works. I would
therefore like to be able to determine the location of the file, D:
or G: drive so I can set an alternate link up.

The current VBA is as below

Sub Link()
On Error Resume Next
Dim stFullName As String
Dim stFileName As String
Dim Wkb As Workbook
stFullName = Sheets("PathSheet").Range("E38")
stFileName = GetFileName(stFullName)
If IsWorkbookOpen(stFileName) Then
Set Wkb = Workbooks(stFileName)
Wkb.Activate
Else
Set Wkb = Workbooks.Open(Filename:=stFullName)
End If
End Sub

Any help would be great.

Don



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
How can I get rid of the pathname? Jos Vens[_2_] Excel Programming 1 December 15th 05 08:26 PM
Pathname reference SB1979 Excel Programming 2 October 11th 05 08:31 PM
Invalid Pathname pumpbhoy Excel Programming 3 March 10th 05 09:03 AM
Filecopy and UNC-pathname Jos Vens Excel Programming 7 February 12th 04 11:10 AM
LoadPicture Pathname or no Pathname Philipp Schramek Excel Programming 1 July 8th 03 03:30 PM


All times are GMT +1. The time now is 07:41 AM.

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

About Us

"It's about Microsoft Excel"