J
JT
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
................................
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
................................