szx248
asked on
VB4 & Excel97/Excel 2000 ???
Here is my dilemma:
I have a VB4 application that manipulates an Excel 5 spreadsheet.
Now we are moving to Excel 97 (and very, very soon to Excel 2000).
When I install Excel 97 VB no longer works with Excel and returns an Error.
Any clue how to get this working with Excel 97/Excel 2000 w/o rewriting the whole application?
Thanks
I have a VB4 application that manipulates an Excel 5 spreadsheet.
Now we are moving to Excel 97 (and very, very soon to Excel 2000).
When I install Excel 97 VB no longer works with Excel and returns an Error.
Any clue how to get this working with Excel 97/Excel 2000 w/o rewriting the whole application?
Thanks
What is the error that you are getting? What does the code look like?
ASKER
This is the code one which it chokes:
MyExcel.Cells(7 + t, 1).Value = DateAdd("yyyy", 1, DateAdd("m", t, CVDate(Text1)))
The Error message is 438
Object doesn't support this property or method
MyExcel.Cells(7 + t, 1).Value = DateAdd("yyyy", 1, DateAdd("m", t, CVDate(Text1)))
The Error message is 438
Object doesn't support this property or method
What is MyExcel dimensioned as? How is it set?
ASKER
Set MyExcel = GetObject(glocationdir & "client.xlt", "excel.sheet")
MyExcel.SaveAs filename:=myfile
MyExcel.Unprotect
MyExcel.Cells(7 + t, 1).Value = DateAdd("yyyy", 1, DateAdd("m", t, CVDate(Text1)))
MyExcel.SaveAs filename:=myfile
MyExcel.Unprotect
MyExcel.Cells(7 + t, 1).Value = DateAdd("yyyy", 1, DateAdd("m", t, CVDate(Text1)))
With Excel97, you .Sheet has changed to .WorkSheet.
You could also do this:
Dim MyExcel As New Excel.Application
Dim MySheet As Excel.Worksheet
Set MySheet = MyExcel.Workbooks.Open(gLo cationDir & "client.xlt")
You could also do this:
Dim MyExcel As New Excel.Application
Dim MySheet As Excel.Worksheet
Set MySheet = MyExcel.Workbooks.Open(gLo
ASKER
Dim MyExcel As New Excel.Application
Here I get "Invalid use of New keyword" error message
If I remove it then I get an error on this line:
Set MySheet = MyExcel.Workbooks.Open(gLo cationDir & "client.xlt")
Error 91
Object doesn't support this property or method
Here I get "Invalid use of New keyword" error message
If I remove it then I get an error on this line:
Set MySheet = MyExcel.Workbooks.Open(gLo
Error 91
Object doesn't support this property or method
Where are you running this from? VB or Excel?
Did you include a reference in your project for Microsoft Excel 8.0 Object Library?
ASKER
running from vb
ASKER
I am using VB4 and I don't see any Rerfernce to Microsoft Excel 8.0 Object Library
Is there a reference to any library that resembles Office or Excel?
I haven't used anything but Office 97 for quite a while so I can't remember what the references for other versions are.
I haven't used anything but Office 97 for quite a while so I can't remember what the references for other versions are.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
At the end just adding
Worksheets("Client").
To
MyExcel.Cells(7 + t, 1).Value = DateAdd("yyyy", 1, DateAdd("m", t, CVDate(Text1)))
like this:
MyExcel.Worksheets("Client ").Cells(7 + t, 1).Value = DateAdd("yyyy", 1, DateAdd("m", t, CVDate(Text1)))
Got it working.
let me know if u think there is something else I may be overlooking.
I am using VB4 with NO refrence to Excel 8.0 to the best that I can deturmine.
Thanks for pointing me in the right direction
Worksheets("Client").
To
MyExcel.Cells(7 + t, 1).Value = DateAdd("yyyy", 1, DateAdd("m", t, CVDate(Text1)))
like this:
MyExcel.Worksheets("Client
Got it working.
let me know if u think there is something else I may be overlooking.
I am using VB4 with NO refrence to Excel 8.0 to the best that I can deturmine.
Thanks for pointing me in the right direction