Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
JT JT is offline
external usenet poster
 
Posts: 234
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default 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
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
Read part of a cell Fiona Excel Discussion (Misc queries) 3 July 24th 07 02:02 PM
how do I read this part of a vlookup statement !1:65536,12,FALSE TJPimpact Excel Discussion (Misc queries) 1 January 11th 07 09:03 PM
read only files Delores Excel Discussion (Misc queries) 1 December 27th 06 02:12 AM
Need Excel to read a text field(part#) and assign a number(commiss sstanton33 Excel Programming 1 March 18th 05 04:08 AM
How to read part of a text string only? Ahsan Excel Programming 4 March 15th 05 06:39 PM


All times are GMT +1. The time now is 05:56 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"