Links and Chdir

G

Guest

Hi
I have 2 questions that I hope someone can help me with

1) Is there any way to turn of the update links box that appears in a workbook that references another workbook. I have tried looking at the links box under edit>link, but the manual button is greyed out.

2) I have the code

chdir "\\Fs8\ssd-css-fin\eco\eco 2004-2005\eco_0405\SystemFiles\eco\
Application.Dialogs(xlDialogOpen).Sho

The first line is simply a ' virtual ' network set-up on my hard drive to imitate my work set-up. But sometimes the open file dialogue box points to the right path and sometimes it does not. This is true even if I use a simple path such as c:\
Is there a reason why it is so temperamental

All help is greatly appreciated

H.
 
R

Ron de Bruin

Hi Hansol

See the VBA help for Workbooks.open
look at the UpdateLinks argument


For point 2
Try to use this and see if it work


Dim FName As Variant
Dim wb As Workbook

your chdir code

FName = Application.GetOpenFilename(filefilter:="Excel Files (*.xls), *.xls")
If FName <> False Then
Set wb = Workbooks.Open(FName)
MsgBox "your code"
wb.Close
End If



--
Regards Ron de Bruin
http://www.rondebruin.nl


Hansol said:
Hi,
I have 2 questions that I hope someone can help me with;

1) Is there any way to turn of the update links box that appears in a workbook that references another workbook. I have tried
looking at the links box under edit>link, but the manual button is greyed out.
2) I have the code;

chdir "\\Fs8\ssd-css-fin\eco\eco 2004-2005\eco_0405\SystemFiles\eco\"
Application.Dialogs(xlDialogOpen).Show

The first line is simply a ' virtual ' network set-up on my hard drive to imitate my work set-up. But sometimes the open file
dialogue box points to the right path and sometimes it does not. This is true even if I use a simple path such as c:\.
 
G

Guest

This isn't a programmed solution to the links msg
suppression problem, but you might find it handy.
I could not suppress those pesky msgs checking off boxes I
found in the LINKS window, but I went to
TOOLS->OPTIONS->EDIT and found on the bottom left of the
window, a list of 4 check boxes, one of which says "Ask to
update links". That box was checked. I unchecked it, and
the msgs stopped!
-----Original Message-----
Hi Hansol

See the VBA help for Workbooks.open
look at the UpdateLinks argument


For point 2
Try to use this and see if it work


Dim FName As Variant
Dim wb As Workbook

your chdir code

FName = Application.GetOpenFilename(filefilter:="Excel Files (*.xls), *.xls")
If FName <> False Then
Set wb = Workbooks.Open(FName)
MsgBox "your code"
wb.Close
End If
appears in a workbook that references another workbook. I
have tried
looking at the links box under edit>link, but the manual button is greyed out.
my hard drive to imitate my work set-up. But sometimes the
open file
dialogue box points to the right path and sometimes it
does not. This is true even if I use a simple path such as c:\.
 
T

Tom Ogilvy

That works by updating the links without prompt. It is the solution if that
is what you want. Until xl2002 there isn't a non-programming solution. In
excel 2002 an option was added under Edit=>Links.


Previously posted by Rob Bovey:

Private Declare Function SetCurrentDirectoryA Lib _
"kernel32" (ByVal lpPathName As String) As Long

Sub ChDirNet(szPath As String)
Dim lReturn As Long
lReturn = SetCurrentDirectoryA(szPath)
If lReturn = 0 Then Err.Raise vbObjectError + 1, "Error setting path."
End Sub

' sample usage

Sub FindFile()
ChDirNet "\\LOGD0FILES\OGILVTW\Docs\Temp"
fName = Application.GetOpenFileName
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top