Hey all,![[wavey] [wavey] [wavey]](/data/assets/smilies/wavey.gif)
I apologise if this question has already be asked.
Im creating a pseudo add-in for excel which looks at the currently opened workbook and then pulls out most of the details such as sheet names, data ranges, headings, ...
On my hunt for code to interact with excel i have found the following different two lines (ive ignored all the other refrencing code from this):
1)
[blue]Set[/blue] objExcel = GetObject(, "Excel.Application")
2)
[blue]Dim[/blue] objExcel [blue]As[/blue] New Excel.application
Number 2 seems to (as it says) create a new instance of excel so ive pretty much ruled this one out.
Number 1 seems to be roughly what i want but does anyone know how to interact with excel once the 'connecting' code has been run?
Below is the code i have been trying to run but only to result in getting error no '91' Object variable or With block variable not set.
Any ideas how i can get this to work?![[smile] [smile] [smile]](/data/assets/smilies/smile.gif)
Many Regards,![[2thumbsup] [2thumbsup] [2thumbsup]](/data/assets/smilies/2thumbsup.gif)
Adam Bates
![[wavey] [wavey] [wavey]](/data/assets/smilies/wavey.gif)
I apologise if this question has already be asked.
Im creating a pseudo add-in for excel which looks at the currently opened workbook and then pulls out most of the details such as sheet names, data ranges, headings, ...
On my hunt for code to interact with excel i have found the following different two lines (ive ignored all the other refrencing code from this):
1)
[blue]Set[/blue] objExcel = GetObject(, "Excel.Application")
2)
[blue]Dim[/blue] objExcel [blue]As[/blue] New Excel.application
Number 2 seems to (as it says) create a new instance of excel so ive pretty much ruled this one out.
Number 1 seems to be roughly what i want but does anyone know how to interact with excel once the 'connecting' code has been run?
Below is the code i have been trying to run but only to result in getting error no '91' Object variable or With block variable not set.
Any ideas how i can get this to work?
![[smile] [smile] [smile]](/data/assets/smilies/smile.gif)
Many Regards,
![[2thumbsup] [2thumbsup] [2thumbsup]](/data/assets/smilies/2thumbsup.gif)
Adam Bates
Code:
[blue]Dim[/blue] objExcel [blue]As[/blue] Excel.application
[blue]Set[/blue] objExcel = GetObject(, "Excel.Application")
Msgbox objExcel.ActiveWorkbook.Name