![]() |
VBA and File System Object
I have a script written that successfully copy's a file to a directory
based on varibles. I now need lines of code that move files. I copied the lines of code to and changed the varibales to match and nothing is moved. If i change the wording back to FSO.CopyFile, it works, but not FSO.MoveFile... any ideas??? If I put in breaks, and hover over the variables, they all have the correct values: code: __________________________________________________ ________________________ Me.txtArchFile = [Forms]![frmGuides]![sfrmFileName]![HypLink] StrFileNameToArch = Me.txtArchFile If IsNull(StrFileNameToArch) Or StrFileNameToArch = "" Then Exit Sub Else FSO.MoveFile Source:=strCurrentLoc & StrFileNameToArch, _ Destination:=strArchLoc & StrFileNameToArch, _ overwritefiles:=True End If Thanks, Dave On Error GoTo 0 |
VBA and File System Object
Is there a way to keep the same file name? I have a link stored in an
access database that stores the file name and would like it to be the same. Does it matter that I use "\\server\" in my path server being an IP address? Die_Another_Day wrote: The trick is to ReName the File using the "Name" Command. Name "C:\Test.Txt" As "C:\Folder\Test2.Txt" Charles Chickering wrote: I have a script written that successfully copy's a file to a directory based on varibles. I now need lines of code that move files. I copied the lines of code to and changed the varibales to match and nothing is moved. If i change the wording back to FSO.CopyFile, it works, but not FSO.MoveFile... any ideas??? If I put in breaks, and hover over the variables, they all have the correct values: code: __________________________________________________ ________________________ Me.txtArchFile = [Forms]![frmGuides]![sfrmFileName]![HypLink] StrFileNameToArch = Me.txtArchFile If IsNull(StrFileNameToArch) Or StrFileNameToArch = "" Then Exit Sub Else FSO.MoveFile Source:=strCurrentLoc & StrFileNameToArch, _ Destination:=strArchLoc & StrFileNameToArch, _ overwritefiles:=True End If Thanks, Dave On Error GoTo 0 |
VBA and File System Object
Name "C:\Test.txt" as "\\192.168.0.1\Data\Test.txt"
Should work Charles wrote: Is there a way to keep the same file name? I have a link stored in an access database that stores the file name and would like it to be the same. Does it matter that I use "\\server\" in my path server being an IP address? Die_Another_Day wrote: The trick is to ReName the File using the "Name" Command. Name "C:\Test.Txt" As "C:\Folder\Test2.Txt" Charles Chickering wrote: I have a script written that successfully copy's a file to a directory based on varibles. I now need lines of code that move files. I copied the lines of code to and changed the varibales to match and nothing is moved. If i change the wording back to FSO.CopyFile, it works, but not FSO.MoveFile... any ideas??? If I put in breaks, and hover over the variables, they all have the correct values: code: __________________________________________________ ________________________ Me.txtArchFile = [Forms]![frmGuides]![sfrmFileName]![HypLink] StrFileNameToArch = Me.txtArchFile If IsNull(StrFileNameToArch) Or StrFileNameToArch = "" Then Exit Sub Else FSO.MoveFile Source:=strCurrentLoc & StrFileNameToArch, _ Destination:=strArchLoc & StrFileNameToArch, _ overwritefiles:=True End If Thanks, Dave On Error GoTo 0 |
All times are GMT +1. The time now is 02:53 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com