Re: Code works with Excel 2000 but not with Excel 2002

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Tom Ogilvy (twogilvy_at_msn.com)
Date: 09/17/04


Date: Fri, 17 Sep 2004 16:21:10 -0400

In your module it should look like this:

Active***.SaveAs Filename:=Filesavename, _
   FileFormat:=xlWorkbookNormal, _
   Password:="", _
  WriteResPassword:="", _
   ReadOnlyRecommended:=False, _
   CreateBackup:=False

I moved the underscores, which are line continuation characters, so they are
on the end and won't wordwrap in the email.

I made the constant xlWorkbookNormal, but I wouldn't expect that to make a
difference:

? xlNormal
-4143
? xlWorkbookNormal
-4143

-- 
Regards,
Tom Ogilvy
"La Durande" <LaDurande@discussions.microsoft.com> wrote in message
news:725E95E6-1606-4B00-83DD-1BA39E279F90@microsoft.com...
> the following VBA works with Excel 2000 but gives error 1004 when used
with
>  Excel 2002 (XP)
> '
> ' 14/09/2004 by Alf Dorrian
> '
>     Range("A2:M73").Select
>     Selection.Copy
>     Workbooks.Add
>
>     Range("A2").Select
>     Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone,
> SkipBlanks:=False _
>         , Transpose:=False
>     Selection.PasteSpecial Paste:=xlFormats, Operation:=xlNone,
> SkipBlanks:=False _
>         , Transpose:=False
>
>
>     Application.CutCopyMode = False
>     Filesavename = Application.GetSaveAsFilename( _
>               fileFilter:="Excel Files (*.xls), *.xls")
>
> If Filesavename <> False Then
>
> (the code below this gives the error)
> Active***.SaveAs Filename:=Filesavename, FileFormat:= _ xlNormal,
> Password:="", WriteResPassword:="",
> ReadOnlyRecommended:=False _  , CreateBackup:=False
>
> End If
> ActiveWorkbook.Close SaveChanges:=False
> ActiveWorkbook.Close SaveChanges:=False
>
> End Sub
>
> Have "repaired" Office XP Pro but still won't work
>

Quantcast