Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help Please..... Problem Saving EXCEL spread Sheet...

Status
Not open for further replies.

Kchinnaswamy

IS-IT--Management
Jan 31, 2001
27
US
Hi
I have a problem when trying to save an Excel spread sheet in Visual Basic ( I can read the data with out any problem)

Here is my Code

Dim oExcel As Object
Set oExcel = CreateObject(sfile)
Set oSheet = oExcel.Worksheets(1)

oSheet.Cells(1,3).Value = 5

oExcel.Application.Quit
Set oExcel = Nothing


I am getting the following error when I say "yes" to save the excel
spread sheet.

Illegal operation

EXCEL caused an invalid page fault in
module <unknown> at 00e7:651447c6.
Registers:
EAX=00412d24 CS=0157 EIP=651447c6 EFLGS=00010206
EBX=00401b34 SS=015f ESP=0062fc1c EBP=00000000
ECX=00000002 DS=015f ESI=00401b34 FS=4d67
EDX=00430d0c ES=015f EDI=00449c10 GS=0000
Bytes at CS:EIP:

Stack dump:
65f1a46b 00449b84 817b6ab8 00449c10 00449c14 00000000 65f19b60
65f1a16c 65f19b60 00000000 fff4fcb1 00449c0c 817b6ab8 65f1a263
65f469e0 00449c0c

I don't know what is missing here.

Please help. If this can be done is a different way, Please suggest.

thanks

Kumar
 
I did try that. Still no use. if you have the code that works please pass it on.

thanks

Kumar.
 
This code works for me in VB5.

Dim xlApp As Excel.Application
Dim xlBook As Excel.Workbook
Dim xlSheet As Excel.Worksheet

Set xlApp = Excel.Application
Set xlBook = xlApp.Workbooks.Add
Set xlSheet = xlBook.Worksheets.Add

//----------- Code goes here

xlApp.Application.Save <= Brings up save dialog box
xlApp.Quit

Set xlSheet = Nothing
Set xlBook = Nothing
Set xlApp = Nothing
Colin Chevrier
colin.chevrier@ca.jdsuniphase.com

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top