Problem using obj.Namespace(sourceFileName) Namespace(DestinationFilename)­.Items and then opening t

  • Thread starter Thread starter Yuvraj
  • Start date Start date
Y

Yuvraj

Hi All,

I have referred to the following links of Ron:
http://www.rondebruin.nl/tips.htm



have already used that code.


Only difference is I am unzipping all the zipped files in my Temp
folder.


But when I am trying to open the zipped files using.


On Error Resume Next
Set filedownload = Application.Workbooks.Open
(filename:=localFilename, ReadOnly:=True, _


AddToMru:=False)


Here localFilename=Temp/
xxxx.zip and Temp= C:
\Document~1\Name\LocalSettiongs\Temp\


I have already unzipped the xxxx.zip and the file inside xxxx.zip is
abcd.xls


When I use the above code where localFilename=Temp/xxxx.zip it used
to open abcd.xls directly. But after we are not using Winzip and
using the code to unzip the zipped file and use the same code to open
the file inside xxxx.zip the abcd.xls inside xxxx.zip and the
abcd.xls which is outside after we have unzipped is not pointing to
the same thing hence when I use the above code it is making a
Temporary folder when we try to open abcd.xls inside xxxx.zip.


The requirement is like this hence we cannot change this but why it
is
forming temporary folder when it was not while using Winzip


Regards,


Yuvraj
 
The solution is simple. Don't use the TEMP directory. Create a subfolder in
the Temp directory and unzip the files to the sub-driectory. The problem is
the workbook with the macro is opened and window creates a copy of your
workbook in the temp directory using the same name as the workbook. When you
open any of the zip files in your macro a temp file will also be created in
the temp directory and you will have two files with the same name so a read
only version will be created with a different version number. but you won't
be able to save any of these files by there original name because a file
already exists and is opened.
 
Back
Top