|
-
May 26th, 2015, 07:15 AM
#1
Thread Starter
Addicted Member
Is it possible get open excel file via GetObject in 64-bit?
Hi guys!
I made unsuccessful attempts to get the running Excel-object.
Code:
Set objExcel = GetObject(, "Excel.Application")
In Windows 7-32b this procedure works correctly.
But under Windows 8-64b on this line, an error occurs:
"Run-Time Error '429': ActiveX component can't create object"
Also, this code is working:
Code:
Set objExcel = CreateObject("Excel.Application")
But I need to get a running instance.
I'm use Windows 8-64 and Excel 2013.
Ten Years After - 01 You Give Me Loving
-
May 15th, 2016, 02:29 PM
#2
Thread Starter
Addicted Member
Re: Is it possible get open excel file via GetObject in 64-bit?
Ten Years After - 01 You Give Me Loving
-
May 15th, 2016, 03:55 PM
#3
Re: Is it possible get open excel file via GetObject in 64-bit?
Set objExcel = GetObject(, "Excel.Application")
works for me in w10 64, xl 2013 32
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
May 16th, 2016, 10:23 AM
#4
Re: Is it possible get open excel file via GetObject in 64-bit?
is office/excel 64bit or 32bit?
-
May 16th, 2016, 11:25 PM
#5
Fanatic Member
Re: Is it possible get open excel file via GetObject in 64-bit?
set xlApp = GetObject(, "Excel.Application")
If an instance of Microsoft Excel is running when this code is executed, you have access to the running instance's object model through the xlApp variable. If no instance is running, you receive the following trappable run-time error message:
Run-time error '429':
ActiveX component can't create object
https://support.microsoft.com/en-us/kb/288902
Use late binding...
http://windowssecrets.com/forums/sho...l-through-word
However using late binding, one looses intellisense, so best of both worlds - during development use early- and in compiled executable late binding.
http://nuke.vbcorner.net/Articoli/VB...T/Default.aspx
Last edited by Tech99; May 16th, 2016 at 11:45 PM.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|