PC Review


Reply
Thread Tools Rate Thread

Addin compatibility between Excel 2k3 and Excel 2k7

 
 
Alain-79
Guest
Posts: n/a
 
      14th Nov 2009
Hi, in oder to force Excel 2007 to generate Excel 2003 files I have been
using this bundle of code inside an Addin

Workbooks(genSyncQteParam.fileName).SaveAs _
fileName:=CStr(SaveAs_path & SaveAsExcel_sourceName), _
FileFormat:=xlExcel8, _
Password:="", _
WriteResPassword:="", _
ReadOnlyRecommended:=False, _
CreateBackup:=False

but... while running this code under Excel 2k3 I receive a message "Compile
error inside one hidd"n module" ... the problem being on FileFormat:=xlExcel8

Assuming I do need this addin to stay for a while compatible between the two
Ecel versions, what can I do ?

I guess I will be facing same kind of trouble with such line code
ActiveSheet.ExportAsFixedFormat type:=xlTypePDF

Thanks for your help
Alain
 
Reply With Quote
 
 
 
 
Alain-79
Guest
Posts: n/a
 
      14th Nov 2009
I have found a way by myself... Three steps...

S1 - As long as compatibility will be requested I will place specific 2k7
code lines in specific modules where when needed I can remove the <<Option
Explicit>> => permits to test and debug evolutions on Excel 2003 without
receiving always the same warnings...

S2 - I have redefine xlExcel8 constant as an integer and control its value
according to the current Application.version running the code...

S3 - I avoid some specific 2k7 code lines while running under 2k3 by testing
the version...

Regards
Alain
 
Reply With Quote
 
Don Guillett
Guest
Posts: n/a
 
      14th Nov 2009
I think?? you can modify this to save as an xls file in either version.
xlNormal

ActiveWorkbook.SaveAs Filename:="C:\yourfolder\yourfilename.xls",
FileFormat:= _
xlNormal, Password:="", WriteResPassword:="",
ReadOnlyRecommended:=False _
, CreateBackup:=False

--
Don Guillett
Microsoft MVP Excel
SalesAid Software
(E-Mail Removed)
"Alain-79" <(E-Mail Removed)> wrote in message
news:7EB9FC17-F2BB-4A5D-AA06-(E-Mail Removed)...
> Hi, in oder to force Excel 2007 to generate Excel 2003 files I have been
> using this bundle of code inside an Addin
>
> Workbooks(genSyncQteParam.fileName).SaveAs _
> fileName:=CStr(SaveAs_path & SaveAsExcel_sourceName), _
> FileFormat:=xlExcel8, _
> Password:="", _
> WriteResPassword:="", _
> ReadOnlyRecommended:=False, _
> CreateBackup:=False
>
> but... while running this code under Excel 2k3 I receive a message
> "Compile
> error inside one hidd"n module" ... the problem being on
> FileFormat:=xlExcel8
>
> Assuming I do need this addin to stay for a while compatible between the
> two
> Ecel versions, what can I do ?
>
> I guess I will be facing same kind of trouble with such line code
> ActiveSheet.ExportAsFixedFormat type:=xlTypePDF
>
> Thanks for your help
> Alain


 
Reply With Quote
 
Alain-79
Guest
Posts: n/a
 
      14th Nov 2009
Thanks for the idea... in fact I thought I was oblige to use the xlExcel8
while in 2K7 // in fact do not remember where I found that ?

Thanks to you // will check
Alain

"Don Guillett" wrote:

> I think?? you can modify this to save as an xls file in either version.
> xlNormal
>
> ActiveWorkbook.SaveAs Filename:="C:\yourfolder\yourfilename.xls",
> FileFormat:= _
> xlNormal, Password:="", WriteResPassword:="",
> ReadOnlyRecommended:=False _
> , CreateBackup:=False
>
> --
> Don Guillett
> Microsoft MVP Excel
> SalesAid Software
> (E-Mail Removed)
> "Alain-79" <(E-Mail Removed)> wrote in message
> news:7EB9FC17-F2BB-4A5D-AA06-(E-Mail Removed)...
> > Hi, in oder to force Excel 2007 to generate Excel 2003 files I have been
> > using this bundle of code inside an Addin
> >
> > Workbooks(genSyncQteParam.fileName).SaveAs _
> > fileName:=CStr(SaveAs_path & SaveAsExcel_sourceName), _
> > FileFormat:=xlExcel8, _
> > Password:="", _
> > WriteResPassword:="", _
> > ReadOnlyRecommended:=False, _
> > CreateBackup:=False
> >
> > but... while running this code under Excel 2k3 I receive a message
> > "Compile
> > error inside one hidd"n module" ... the problem being on
> > FileFormat:=xlExcel8
> >
> > Assuming I do need this addin to stay for a while compatible between the
> > two
> > Ecel versions, what can I do ?
> >
> > I guess I will be facing same kind of trouble with such line code
> > ActiveSheet.ExportAsFixedFormat type:=xlTypePDF
> >
> > Thanks for your help
> > Alain

>
> .
>

 
Reply With Quote
 
Jon Peltier
Guest
Posts: n/a
 
      15th Nov 2009
Don -

xlNormal is Excel 8 format in Excel 2003 and Excel 12 format in Excel
2007. The user asked for Excel 8 format in when running both versions.

Alain -

I've used a function that gives me the constant value I need:

Function xl8FileFormat() as long
If Val(Application.Version) >= 12 Then
xlFileFormat = 56 ' value of xlExcel8 constant
Else
xlFileFormat = xlNormal
End If
End Function

Do the same kind of thing for PDF.

- Jon
-------
Jon Peltier
Peltier Technical Services, Inc.
http://peltiertech.com/



Don Guillett wrote:
> I think?? you can modify this to save as an xls file in either version.
> xlNormal
>
> ActiveWorkbook.SaveAs Filename:="C:\yourfolder\yourfilename.xls",
> FileFormat:= _
> xlNormal, Password:="", WriteResPassword:="",
> ReadOnlyRecommended:=False _
> , CreateBackup:=False
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Multiple Excel addin versions having LaodBehaviour issue at Addin Dwipayan Das Microsoft Excel Programming 0 17th Apr 2009 05:51 AM
setup project for Excel addin, won't register addin =?Utf-8?B?R2Vycnk=?= Microsoft Excel Programming 0 31st Oct 2007 12:01 AM
Excel Addin: preprocessing the data on opening excel files in EXCE =?Utf-8?B?UnAwMDc=?= Microsoft Excel Programming 3 27th Sep 2006 09:06 PM
Can't get rid of a specific Excel addin in MSIE - I managed to get rid of it in Excel but not in the excel addin for ie WMB Windows XP Internet Explorer 0 20th Apr 2005 06:43 PM
howtofix excel 2000 says invalid AddIn for valid excel97 AddIn robm Microsoft Excel Discussion 0 24th Sep 2003 06:06 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:08 AM.