Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Calling workbook.saveas depending on excel version

Ryan,
Write the code in the oldest version you intend to support.
Additional arguments in later versions are optional and if missing, take
their default values.
If this were not true, there would be no such thing as backwards
compatibility.

NickHK

"Ryan" wrote in message
ups.com...
Hi,

I am working on some software that integrates an excel workbook. I am
having a problem calling the workbook.saveas method. I am developing on
XP with excel 2003, but i need this code to work with excel 2000.
Apparently excel 2000 requires saveas to have 10 arguments while excel
2003 requires 12 arguments. Ideally I would have something like this:

if (System.String.Compare(_app.Version,"10") < 0)
{
//Office 2000
_wb.SaveAs(_strFilename, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing,
Excel.XlSaveAsAccessMode.xlNoChange,Type.Missing, Type.Missing,
Type.Missing);
}
else
{
//Office XP
_wb.SaveAs(_strFilename, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing,
Excel.XlSaveAsAccessMode.xlNoChange,Type.Missing, Type.Missing,
Type.Missing, Type.Missing,Type.Missing);
}

However I cannot compile this on my XP machine because it says "no
overload for method saveas takes 10 arguments" at the first SaveAs
call.

Help!



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
Modify Macro Code Depending on Excel Version John Taylor Excel Discussion (Misc queries) 11 February 26th 07 04:19 AM
Excel workbook.saveas freezes program Ryan[_12_] Excel Programming 2 July 24th 06 05:51 PM
Calling a specific version of Access. Derek Anderson Excel Programming 2 June 17th 05 09:00 PM
Code in Sub OKButton_Click to trigger actions depending on calling macro Herman[_4_] Excel Programming 1 October 26th 04 06:52 PM
saveas calling a variable Douvid Excel Programming 6 July 28th 03 08:46 AM


All times are GMT +1. The time now is 07:17 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"