ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   REPOST:Need help moving XL2K to XLXP, please (https://www.excelbanter.com/excel-programming/296286-repost-need-help-moving-xl2k-xlxp-please.html)

Ed[_18_]

REPOST:Need help moving XL2K to XLXP, please
 
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



SidBord

REPOST:Need help moving XL2K to XLXP, please
 
I'm not sure it will help any, but shouldn't you be using
the Excel 11 Library??
-----Original Message-----
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


.


TroyW[_2_]

REPOST:Need help moving XL2K to XLXP, please
 
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


"Ed" wrote in message
...
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





Harald Staff

REPOST:Need help moving XL2K to XLXP, please
 
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

"Ed" skrev i melding
...
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





Ed[_18_]

REPOST:Need help moving XL2K to XLXP, please
 
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

"Harald Staff" wrote in message
...
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

"Ed" skrev i melding
...
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







Harald Staff

REPOST:Need help moving XL2K to XLXP, please
 
"Ed" skrev i melding
...
Harald: Thank you! I had a MISSING reference to File Management 1.0.


Glad to hear that Ed. Thanks for the feedback.

Best wishes Harald




All times are GMT +1. The time now is 03:59 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com