Opening and changing in excel file

Hi
i want to open an excel file display and make change in a column from powerbuilder
and refresh the sheet automaticall i need an urgent help
thanks
SHFDEVAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

tr1l0b1tCommented:
This sample performs :
  - Open Excel file
  - Change cell value
  - Save the file
  - Quit

////////////////////////////////////////
Integer li_rtn
OleObject lole_excel
lole_excel = CREATE OLEObject
li_rtn = lole_excel.ConnectToNewObject("excel.application")
IF li_rtn <> 0 THEN
      MessageBox( "Error", 'Error running MS Excel api.')
      DESTROY lole_Excel
      RETURN -1
END IF
lole_excel.visible = TRUE
lole_excel.WorkBooks.Open("C:\MYEXCELFILE.XLS")
lole_excel.Application.Visible = TRUE

// Set the cell value
lole_excel.application.workbooks(1).worksheets(1).cells(1,1).value = "TESVALUE"

// Save
lole_excel.application.workbooks(1).save()

// Quit
lole_excel.application.quit()

lole_excel.DisconnectObject()
DESTROY lole_excel
////////////////////////////////////////

Hope it helps
Regards
0
SHFDEVAuthor Commented:
THANKS
BUT THERE IS ONLY ONE PROBLEM IT WILL CHANGE THE VALUSE BUT IF HAVE SOME FORMULA ON OTHER COLUMN BASE ON THIS COLUMN THAT WILL NOT RREFRESH WICH I CAN REFRESH BY PRSSINF f5 BUT I DONT WANT USER TO PRESS f5 I WANT OT REFRESH AUTOMATICALLY AFTER CHANGING THE VALUE
THANKS IN ADVANCE
0
SHFDEVAuthor Commented:
HI
AND IT IS ALSO NOT ADDINF THE Add-INS PLS HELP
0
Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

tr1l0b1tCommented:
use ...

lole_excel.application.calculatefull()

...after setting cell values.
Regards
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
SHFDEVAuthor Commented:
thanks
the last thing is about add-in for excel
we have our own add-in for printing when i open the excel
through sheel execute and use connecttoobject it workks fine
but when i  open the excel through ole and open the workbook it does not show add-in in the formulas can u please help the above comments really helpfull and job is done
Regards
Rabbani

0
tr1l0b1tCommented:
SHFDEV, I've downloaded a free Excel Add-In called WebCabXL
(http://www.webcabcomponents.com/office/) to work around
your problem, and it works fine when I open Excel from PB
using OLE automation.

It may be a security issue -> Make sure that all installed add-ins are
fully trusted. Go to Tools | Macro | Security... inside Excel, click the
Trusted Sources tab and check (enable) "Trust all installed add-ins
and templates".
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Editors IDEs

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.