View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Christy Christy is offline
external usenet poster
 
Posts: 89
Default copy from closed workbook again! ;(

Thank you Walt, I will have him check that setting.

"Walt Weber" wrote:

Hi Christy,

On your co-worker's machine and in Excel, check
Tools/Options General Tab Default File Location. This
field may not have a valid path specified.

Best Regards,
Walt
-----Original Message-----
I have the following code which works perfectly on my

office computer. I
sent it to the co-worker I made it for who is attached

to the LAN and it
crashes on the line:

ChDrive MyPath

Does anyone have any idea what the problem is or how I

can fix it. We
commented out that line and it crashed on the next on and

we commented out
that line and it crashed on the next one.


Sub GetDataFromClosedWB()
Dim SaveDriveDir As String, MyPath As String
Dim FName As Variant

Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual

SaveDriveDir = CurDir
MyPath = Application.DefaultFilePath 'or

use "C:\Data"
ChDrive MyPath
ChDir MyPath
FName = Application.GetOpenFilename

(filefilter:="Excel Files, *.xls")

If FName = False Then
'do nothing
Else

'Get Fridays date and Office city/state/zip
GetData FName, "Saturday", "b1:b2", Sheets

("Source").Range("b2"),
False
GetData FName, "Saturday", "b2:b3", Sheets

("Source").Range("b3"),
False

End If

Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic

ChDrive SaveDriveDir
ChDir SaveDriveDir
End Sub

.