Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Opening and changing in excel file

Posted on 2006-04-03
6
Medium Priority
?
1,268 Views
Last Modified: 2013-12-26
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
0
Comment
Question by:SHFDEV
  • 3
  • 3
6 Comments
 
LVL 6

Expert Comment

by:tr1l0b1t
ID: 16358735
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
 

Author Comment

by:SHFDEV
ID: 16358893
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
 

Author Comment

by:SHFDEV
ID: 16359037
HI
AND IT IS ALSO NOT ADDINF THE Add-INS PLS HELP
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 6

Accepted Solution

by:
tr1l0b1t earned 1000 total points
ID: 16360964
use ...

lole_excel.application.calculatefull()

...after setting cell values.
Regards
0
 

Author Comment

by:SHFDEV
ID: 16367741
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
 
LVL 6

Expert Comment

by:tr1l0b1t
ID: 16373048
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

Featured Post

Become an Android App Developer

Ready to kick start your career in 2018? Learn how to build an Android app in January’s Course of the Month and open the door to new opportunities.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In our object-oriented world the class is a minimal unit, a brick for constructing our applications. It is an abstraction and we know well how to use it. In well-designed software we are not usually interested in knowing how objects look in memory. …
How to install Selenium IDE and loops for quick automated testing. Get Selenium IDE from http://seleniumhq.org Go to that link and select download selenium in the right hand column That will then direct you to their download page. From that p…
THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.

578 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question