Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Wed Jan 17, 2018 6:56 pm
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: How to use the method Excel.Workbooks.Open ?
PostPosted: Sun Jun 03, 2012 7:33 pm 
Offline
User avatar

Joined: Thu Dec 29, 2011 6:46 pm
Posts: 191
Location: Edmonton, AB, Canada
Hi,

I am trying to open a specific Excel Workbook using the code below:

Dim excel As New ExcelApplication

// We're assuming that there's already a workbook created,
// otherwise we'll get an exception

Excel.Workbooks.Open "C:\MyExcelWorkBook.xls"


Exception err As OLEException
MsgBox err.Message


Unfortunately the code doesn't work, is there anybody that could help me ?

Regards,
Tomaz

_________________
Regards,
TomazVDaSilva


Clean Code: Robert C. Martin
It is not the language that makes programs appear simple.
It is the programmer that make the language appear simple!


Top
 Profile  
Reply with quote  
 Post subject: Re: How to use the method Excel.Workbooks.Open ?
PostPosted: Sun Jun 03, 2012 9:23 pm 
Offline
User avatar

Joined: Thu Dec 29, 2011 6:46 pm
Posts: 191
Location: Edmonton, AB, Canada
Hi,

Here is the answer:

Dim objExcel As ExcelApplication
Dim objExcelWorkbook As ExcelWorkbooks

Dim sExcelFilePath As string
Dim sExcelFileName As string

sExcelFilePath = "C:\Users\Me\Desktop"
sExcelFileName = "myExcelFile.xls"

objExcel = new ExcelApplication
objExcel.visible = true

objExcel.Workbooks.Open (sExcelFilePath+"\"+sExcelFileName)

Exception err As OLEException
MsgBox err.Message


Regards,
Tomaz

_________________
Regards,
TomazVDaSilva


Clean Code: Robert C. Martin
It is not the language that makes programs appear simple.
It is the programmer that make the language appear simple!


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group