Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,560
Default Extra "." in file name when creating zip file in 2007 with 2003 co

I have some code that works great in Excel 2003, but in 2007, when creating a
zip file, there is an extra "." in the file name, like filenameZ..zip. It
happens in both the filename inside the zip file AND in the zip file itself.
Here is the suspect code:
FileNameZip = DefPath & Left(ActiveWorkbook.Name, Len(ActiveWorkbook.Name) -
4) & ".zip"
FileNameXls = DefPath & Left(ActiveWorkbook.Name,
Len(ActiveWorkbook.Name) - 4) & "Z" & ".xlsm"
I've changed the file extension to xlsm, but if I try to change the
FileNameXls to Xlsm, it does not work.
Does anyone have any ideas? I got this code from Ron several years ago.
THanks much!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 117
Default Extra "." in file name when creating zip file in 2007 with 2003 co

In 2007 the file extensions are 4 characters and not 3 (xlsx and xlsm) so
your code Len(activeworkbook.Name) - 4 is not stripping off the "." anymore.
It needs to be Len(activeworkbook.Name) - 5

"David" wrote:

I have some code that works great in Excel 2003, but in 2007, when creating a
zip file, there is an extra "." in the file name, like filenameZ..zip. It
happens in both the filename inside the zip file AND in the zip file itself.
Here is the suspect code:
FileNameZip = DefPath & Left(ActiveWorkbook.Name, Len(ActiveWorkbook.Name) -
4) & ".zip"
FileNameXls = DefPath & Left(ActiveWorkbook.Name,
Len(ActiveWorkbook.Name) - 4) & "Z" & ".xlsm"
I've changed the file extension to xlsm, but if I try to change the
FileNameXls to Xlsm, it does not work.
Does anyone have any ideas? I got this code from Ron several years ago.
THanks much!

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Extra "." in file name when creating zip file in 2007 with 2003 co

David,

File extensions in E2007 are 4 characters .long so your part line
Len(ActiveWorkbook.Name) - 4)

is taking away the xlsm but not the period and because you then add a period
you get 2

Len(ActiveWorkbook.Name) - 5)

should do the trick.

Mike
"David" wrote:

I have some code that works great in Excel 2003, but in 2007, when creating a
zip file, there is an extra "." in the file name, like filenameZ..zip. It
happens in both the filename inside the zip file AND in the zip file itself.
Here is the suspect code:
FileNameZip = DefPath & Left(ActiveWorkbook.Name, Len(ActiveWorkbook.Name) -
4) & ".zip"
FileNameXls = DefPath & Left(ActiveWorkbook.Name,
Len(ActiveWorkbook.Name) - 4) & "Z" & ".xlsm"
I've changed the file extension to xlsm, but if I try to change the
FileNameXls to Xlsm, it does not work.
Does anyone have any ideas? I got this code from Ron several years ago.
THanks much!

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Extra "." in file name when creating zip file in 2007 with 2003 co

Hi David

I see that the macro on my site is not correct
I will update it today and post the link here

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"David" wrote in message ...
I have some code that works great in Excel 2003, but in 2007, when creating a
zip file, there is an extra "." in the file name, like filenameZ..zip. It
happens in both the filename inside the zip file AND in the zip file itself.
Here is the suspect code:
FileNameZip = DefPath & Left(ActiveWorkbook.Name, Len(ActiveWorkbook.Name) -
4) & ".zip"
FileNameXls = DefPath & Left(ActiveWorkbook.Name,
Len(ActiveWorkbook.Name) - 4) & "Z" & ".xlsm"
I've changed the file extension to xlsm, but if I try to change the
FileNameXls to Xlsm, it does not work.
Does anyone have any ideas? I got this code from Ron several years ago.
THanks much!

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Extra "." in file name when creating zip file in 2007 with 2003 co

Small fix

This will work for Excel 97-200 and 2007-2010 files
http://www.rondebruin.nl/windowsxpzip.htm


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Ron de Bruin" wrote in message ...
Hi David

I see that the macro on my site is not correct
I will update it today and post the link here

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"David" wrote in message ...
I have some code that works great in Excel 2003, but in 2007, when creating a
zip file, there is an extra "." in the file name, like filenameZ..zip. It
happens in both the filename inside the zip file AND in the zip file itself.
Here is the suspect code:
FileNameZip = DefPath & Left(ActiveWorkbook.Name, Len(ActiveWorkbook.Name) -
4) & ".zip"
FileNameXls = DefPath & Left(ActiveWorkbook.Name,
Len(ActiveWorkbook.Name) - 4) & "Z" & ".xlsm"
I've changed the file extension to xlsm, but if I try to change the
FileNameXls to Xlsm, it does not work.
Does anyone have any ideas? I got this code from Ron several years ago.
THanks much!

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
Selecting "Save As" adds "Copy of" to file name- MS Excel 2007 ronhansen Excel Discussion (Misc queries) 1 November 15th 09 09:33 PM
"Too Many Cell Formats" Error when opening a 2007 XLS file in 2003 James Excel Discussion (Misc queries) 0 November 3rd 09 02:14 AM
Unable to open a 82 KB XLSM file due to "Too many different cellformats" & "Converter failed to open the file." errors. Phillip Pi Excel Discussion (Misc queries) 0 April 23rd 09 08:53 PM
creating an XLS file from " files" data in a Folder Edwin Mashiringwani Excel Discussion (Misc queries) 2 November 19th 05 04:45 PM
Problem- Recording macros for "file save" and "File open" tritaco Excel Programming 1 April 22nd 04 06:15 PM


All times are GMT +1. The time now is 06:50 AM.

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"