REPOST:Need help moving XL2K to XLXP, please

E

Ed

I have been upgraded at work from Office and Windows 2000 to XP. I'm
having difficulty getting my macros to function. One errors on LEFT in

wb1.SaveAs Left(wb1.Name, Len(wb1.Name) - 4) & "1.xls", _
xlWorkbookNormal

I referenced the Excel 10 library, as well as Word 10 and VBA and others,
but I can't get it to work! Can someone please tell me what new references
I
need to set to make things work again?

Ed
 
T

TroyW

Ed,

Your code example works fine for me in ExcelXP / WinXP. Just one
troubleshooting idea, use a string variable to hold the new filename. Verify
that the value of the string is a valid filename (See below).

Another idea is to replace "xlWorkbookNormal" with it's numeric
alue: -4143
Change:
wb1.SaveAs sFilename, xlWorkbookNormal

To:
wb1.SaveAs sFilename, -4143

Troy


Sub Test1()
Dim wb1 As Workbook
Dim sFilename As String

Set wb1 = ThisWorkbook
sFilename = Left(wb1.Name, Len(wb1.Name) - 4) & "1.xls"
MsgBox "===" & sFilename & "===" & vbCr & vbCr & "Length = " &
Len(sFilename)
wb1.SaveAs sFilename, xlWorkbookNormal
Set wb1 = Nothing
End Sub
 
H

Harald Staff

Hi Ed

If you get errors on perfectly valid syntax, check references, unselect
everything marked "missing", Save and retry. Perhaps you tried that already,
but worth mentioning.

Your code assumes that the filename ends with ".xls". It may not if the
horrid "hide file extensions for known files" is selected within
Windows -and it tends to be. So first, test if the right part actually is
".xls" (test case insensitive !!!) before replacing it with "1.xls"

HTH. Best wishes Harald
 
E

Ed

Harald: Thank you! I had a MISSING reference to File Management 1.0. I
was searching for where XP stashed the new one. But when I just unchecked
it, it's all fine now. I appreciate the boost.

Ed
 
Top