Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Read Only Files - Part 2
Below is part of the code I have in a macro. I just add the if statement
below to see if a file is "read only". If it is "read only" then I want to do the following 3 lines. The first 2 work and when it hits the 3rd line, it jumps out of the module. I can't figure out what is wrong with the 3rd line because the 3 lines were copied from the 3 lines from the "If vErrMsg = "Success" Then" if statement and it works there. The only difference is I haven't checked the ReadOnly property. Am I missing something? Any help would be greatly appreciated. Thanks... ........ If xlApp.Workbooks(vlBook).ReadOnly = True Then xlApp.Workbooks(vlBook).SaveAs ("\\Vs300\rental_public\VG\VanRmktg\Rmkt Processed\X_Read Only Records\" & FoundModel) '(works) xlApp.Workbooks(vlBook).Close SaveChanges:=False ' (works) MyObj.deleteFile "\\Vs300\rental_public\VG\VanRmktg\Rmkt to Process\New\" & FoundModel '(doesn't work) Else SendtoUSDatabase If vErrMsg = "Success" Then xlApp.Workbooks(vlBook).SaveAs ("\\Vs300\rental_public\VG\VanRmktg\Rmkt Processed\" & FoundModel) '(works) xlApp.Workbooks(vlBook).Close SaveChanges:=False '(works) MyObj.deleteFile "\\Vs300\rental_public\VG\VanRmktg\Rmkt to Process\New\" & FoundModel '(works) Else ................................ -- JT |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Read Only Files - Part 2
I think you may be mising this definition. Myobj should be fs.
Set fs = CreateObject("Scripting.FileSystemObject") fs.deleteFile "\\Vs300\rental_public\VG\VanRmktg\Rmkt to Process\New\" & Below is part of the code I have in a macro. I just add the if statement below to see if a file is "read only". If it is "read only" then I want to do the following 3 lines. The first 2 work and when it hits the 3rd line, it jumps out of the module. I can't figure out what is wrong with the 3rd line because the 3 lines were copied from the 3 lines from the "If vErrMsg = "Success" Then" if statement and it works there. The only difference is I haven't checked the ReadOnly property. Am I missing something? Any help would be greatly appreciated. Thanks... ....... If xlApp.Workbooks(vlBook).ReadOnly = True Then xlApp.Workbooks(vlBook).SaveAs ("\\Vs300\rental_public\VG\VanRmktg\Rmkt Processed\X_Read Only Records\" & FoundModel) '(works) xlApp.Workbooks(vlBook).Close SaveChanges:=False ' (works) MyObj.deleteFile "\\Vs300\rental_public\VG\VanRmktg\Rmkt to Process\New\" & FoundModel '(doesn't work) Else SendtoUSDatabase If vErrMsg = "Success" Then xlApp.Workbooks(vlBook).SaveAs ("\\Vs300\rental_public\VG\VanRmktg\Rmkt Processed\" & FoundModel) '(works) xlApp.Workbooks(vlBook).Close SaveChanges:=False '(works) MyObj.deleteFile "\\Vs300\rental_public\VG\VanRmktg\Rmkt to Process\New\" & FoundModel '(works) Else ............................... -- JT |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Read part of a cell | Excel Discussion (Misc queries) | |||
how do I read this part of a vlookup statement !1:65536,12,FALSE | Excel Discussion (Misc queries) | |||
read only files | Excel Discussion (Misc queries) | |||
Need Excel to read a text field(part#) and assign a number(commiss | Excel Programming | |||
How to read part of a text string only? | Excel Programming |