Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Mon Sep 24, 2018 4:23 am
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Open a Excel File
PostPosted: Sun Jun 03, 2012 9:59 pm 
Offline
User avatar

Joined: Thu Dec 29, 2011 6:46 pm
Posts: 191
Location: Edmonton, AB, Canada
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,
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: Open a Excel File
PostPosted: Mon Jun 04, 2012 1:09 am 
Offline

Joined: Mon May 30, 2011 12:56 am
Posts: 702
Safer method because Microsoft has a history of changing the actual paths to folders:

Dim objExcel As ExcelApplication
Dim objExcelWorkbook As ExcelWorkbooks

Dim sExcelFilePath As string
Dim sExcelFileName As string
Dim fExcelFile as folderitem
fExcelFile = specialFolder.Desktop.child("myExcelFile.xls")

objExcel = new ExcelApplication
objExcel.visible = true

objExcel.Workbooks.Open (fExcelFile.absolutepath)

Exception err As OLEException
MsgBox err.Message


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