Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 287
Default SaveAs file lost

Hello,

I have to following code which does a save as and saves the file in the
directory listed.

Sub SaveWithDate()
'
Dim wb As Workbook
Dim ws As Worksheet
Dim varVal As Variant
Dim strFileName As String

Set wb = ActiveWorkbook
Set ws = wb.Worksheets("$ Reference")
varVal = ws.Range("C2").Value

If IsDate(varVal) Then
strFileName = "Glue Sched_" & Format(CStr(varVal), "mm-dd-yyyy") &
".xls"
Else
strFileName = "Glue Sched_" & Format(CStr(Date), "mm-dd-yyyy") &
".xls"
End If
ChDir "\\Lan1\Supervisor\Departments\Foam\SCHEDULING \Old Schedules\"
ActiveWorkbook.SaveAs Filename:=strFileName


Set wb = Nothing
Set ws = Nothing

End Sub

The part am not understanding is that when I run my workbook and this macro
from my computer, it works perfect and saves the file in the listed
directory. When a fellow employee ran this, it saved the file to my docs
under his profile. I know he has access to the above directory, so I don't
understand what might be causing that. It's almost like it automatically
changes directories again when it performs the SaveAs. Any ideas??
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 219
Default SaveAs file lost

Instead of...
ChDir "\\Lan1\Supervisor\Departments\Foam\SCHEDULING \Old Schedules\"
ActiveWorkbook.SaveAs Filename:=strFileName
try...
ActiveWorkbook.SaveAs Filename:="\\Lan1
\Supervisor\Departments\Foam\SCHEDULING\Old Schedules\"
& strFileName

HTH,
--
Gary Brown

If this post was helpful, please click the ''Yes'' button next to ''Was this
Post Helpfull to you?''.


"Aaron" wrote:

Hello,

I have to following code which does a save as and saves the file in the
directory listed.

Sub SaveWithDate()
'
Dim wb As Workbook
Dim ws As Worksheet
Dim varVal As Variant
Dim strFileName As String

Set wb = ActiveWorkbook
Set ws = wb.Worksheets("$ Reference")
varVal = ws.Range("C2").Value

If IsDate(varVal) Then
strFileName = "Glue Sched_" & Format(CStr(varVal), "mm-dd-yyyy") &
".xls"
Else
strFileName = "Glue Sched_" & Format(CStr(Date), "mm-dd-yyyy") &
".xls"
End If
ChDir "\\Lan1\Supervisor\Departments\Foam\SCHEDULING \Old Schedules\"
ActiveWorkbook.SaveAs Filename:=strFileName


Set wb = Nothing
Set ws = Nothing

End Sub

The part am not understanding is that when I run my workbook and this macro
from my computer, it works perfect and saves the file in the listed
directory. When a fellow employee ran this, it saved the file to my docs
under his profile. I know he has access to the above directory, so I don't
understand what might be causing that. It's almost like it automatically
changes directories again when it performs the SaveAs. Any ideas??

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
Confused here Prevent Saving File - but allow ONLY File SAVEAS Met JMay Excel Discussion (Misc queries) 2 June 17th 07 04:37 PM
saveas CSV file stevekirk Excel Discussion (Misc queries) 0 August 10th 06 01:11 PM
File SaveAs FinChase Excel Programming 1 March 7th 06 01:41 AM
VBA-Excel. File-SaveAs [email protected] Excel Programming 3 February 17th 05 08:42 AM
Saveas with name of another file sowetoddid[_19_] Excel Programming 15 June 11th 04 04:53 PM


All times are GMT +1. The time now is 01:24 PM.

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"