How i write to a excell to active sheet.
example sheet name is Panel and the cell is B4
How i write to a excell to active sheet.
example sheet name is Panel and the cell is B4
I have this working but how i now is the excel file if open to void re open
Dim excel As New ExcelApplication
Dim book As ExcelWorkbook
dim f as FolderItem
dim i as integer
f=GetFolderItem(“C:\Users\p-user\Desktop\Calcualtion sheets-new mayo 8 2012.xlsx”)
excel.Workbooks.Open(f.AbsolutePath) <<<<<< how i check is open or no
excel.Visible = true
excel.ActiveSheet.Name=“CAL”
excel.Range(“B4”).value = “1.0625”
excel.Range(“G69”).value = “test02”
excel.Range(“B73”).value = “test03”
Exception err as OLEException
MsgBox err.message
(I’m recalling how this works)
Try something like this:
[code]Dim excel As New ExcelApplication
Dim book As ExcelWorkbook
Dim sheet As ExcelWorksheet
dim f as FolderItem
dim i as integer
f=GetFolderItem(“C:\Users\p-user\Desktop\Calcualtion sheets-new mayo 8 2012.xlsx”)
if f.Exists then
book = excel.Workbooks.Open(f.AbsolutePath)
if book = Nil then
MsgBox “Unable to open Workbook”
return
end if
end if
excel.Visible = true
sheet = book.Worksheets.Item(“CAL”)
sheet.Range(“B4”).value = “1.0625”
sheet.Range(“G69”).value = “test02”
sheet.Range(“B73”).value = “test03”
Exception err as OLEException
MsgBox err.message[/code]
Use the book and sheet elements to navigate the workbook.
thanks