Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I'd check to see if that new path actually exists.
You could always try to create the new folder in code: on error resume next Replace(ThisWorkbook.Path, "DRAFT", "FINAL") on error goto 0 And I'd use the compare parm in the replace statement, too. I'd want to do a text comparison. Ray wrote: Hi Dave - Thanks for the response ... I'd already found the 'Replace' function and deleted the Posting (via GoogleGroups) but guess that doesn't completely delete it. OK, so I've gotten past one problem ... but run into another. Here's the current code: Sub SaveFinal() Dim Store As String, Day As String, Period As String Dim OurCopy As String, SOCopy As String Application.ScreenUpdating = False Application.DisplayAlerts = False Store = ActiveSheet.Range("D16").Value Day = ActiveSheet.Range("D17").Value Period = ActiveSheet.Range("D18").Value Draft = ThisWorkbook.Path & "\" & ThisWorkbook.Name Final = Replace(ThisWorkbook.Path, "DRAFT", "FINAL") & "\" & Replace(ThisWorkbook.Name, "_DRAFT", "") If Right(ThisWorkbook.Name, 9) < "DRAFT.xls" Then MsgBox "Sorry, this file isn't eligible to be saved as a FINAL version ... you must save as DRAFT first!" Exit Sub End If If ActiveWorkbook.Sheets("Journal").Visible = False Then MsgBox "Sorry, only a POSTED CashRec can be saved as FINAL version ... please post the Rec and try again!" Else If Dir(Replace(ThisWorkbook.Path, "DRAFT", "FINAL")) = "" Then MkDir (Replace(ThisWorkbook.Path, "DRAFT", "FINAL")) ActiveWorkbook.Save ' RON'S CODE: Name "C:\Users\Ron\SourceFolder\Test.xls" As "C:\Users\Ron\DestFolder\TestNew.xls" ' ERROR on next line Name ThisWorkbook.Path & "\" & ThisWorkbook.Name As Replace(ThisWorkbook.Path, "DRAFT", "FINAL") & "\" & Replace(ThisWorkbook.Name, "_DRAFT", "") End If Unload SaveType End Sub I get error 75: Path/File access error on the line indicated .... any ideas how to modify this to do what I want?3 Thanks again, ray -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Workbook.Path | Excel Programming | |||
VBA Trim - has no effect in workbook- looking for ideas | Excel Programming | |||
VBA Trim and Application.worksheetfunction.Trim | Excel Programming | |||
Trim path from full filename | Excel Programming | |||
path of workbook | Excel Programming |