r/MSAccess • u/TheCarrot007 • 26d ago
[SOLVED] Excel VBA issues
Hi,
Just wanting to see if anyone can shed any light on an issue I am having.
BACKGROUND: I have been on holiday for a week and returned with this problem. Yes IT, but yeah that's going to take weeks with this sort of query and and other help is appreciated.
THE PROBLEM: I have an access database I use to create a few reports in excel. Last ran on 20th Oct. Back yesterday and I am getting an error.
Access is pretty much saying the object Excel.Workbook no longer exists. Initial error was saying .SAVE is non existent. Begin commenting thing out and yes the class does not seem to exist. Just got a work new laptop and had not moved things onto it. Spend the morning setting it up, exactly the same result!
Ask colleague to run it, works fine (checked we are on the same office build just in case). So It seems to be a me issue, but on 2 separate machines. I have tried a lot of things like repair office, various windows fixes (dism cleanupimage/sfc (online said it might help, I doubted it)), unregistering and reregistering excel.exe (/unregserver etc), moved to late binding. Nothing worked.
Is it possible someone set something on my account that does this? If so why is excel.application still working. I guess I could rewrite to not use a separate excel.workbook as I think that is possible but again that will be a lot of changes and I just have never done it that way.
At the most basic level with most thing commented out having a
Set oXLBook = CreateObject("Excel.Workbook")Means I get the error "ActiveX component can't create object (as as said works fine for excel.application).
If you need more info just ask.
Thanks,
•
u/AutoModerator 26d ago
IF YOU GET A SOLUTION, PLEASE REPLY TO THE COMMENT CONTAINING THE SOLUTION WITH 'SOLUTION VERIFIED'
Full set of rules can be found here, as well as in the user interface.
Below is a copy of the original post, in case the post gets deleted or removed.
User: TheCarrot007
Excel VBA issues
Hi,
Just wanting to see if anyone can shed any light on an issue I am having.
BACKGROUND: I have been on holiday for a week and returned with this problem. Yes IT, but yeah that's going to take weeks with this sort of query and and other help is appreciated.
THE PROBLEM: I have an access database I use to create a few reports in excel. Last ran on 20th Oct. Back yesterday and I am getting an error.
Access is pretty much saying the object Excel.Workbook no longer exists. Initial error was saying .SAVE is non existent. Begin commenting thing out and yes the class does not seem to exist. Just got a work new laptop and had not moved things onto it. Spend the morning setting it up, exactly the same result!
Ask colleague to run it, works fine (checked we are on the same office build just in case). So It seems to be a me issue, but on 2 separate machines. I have tried a lot of things like repair office, various windows fixes (dism cleanupimage/sfc (online said it might help, I doubted it)), unregistering and reregistering excel.exe (/unregserver etc), moved to late binding. Nothing worked.
Is it possible someone set something on my account that does this? If so why is excel.application still working. I guess I could rewrite to not use a separate excel.workbook as I think that is possible but again that will be a lot of changes and I just have never done it that way.
At the most basic level with most thing commented out having a
Means I get the error "ActiveX component can't create object (as as said works fine for excel.application).
If you need more info just ask.
Thanks,
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
4
u/maxquordleplee3n 26d ago
Probably reference related, first check your version of Access, then check for missing references.
1
u/Breitsol_Victor 26d ago
Was there a switch to O365? Check the install.
1
u/George_Hepworth 5 26d ago
I agree that the symptoms point toward a reference problem. How are you dimming oXLBook, as a Object or as Excel? If you late bind by dimming as an object, does that help?
1
u/PerfectMachine1196 26d ago
Glad it's solved! What ended up being the fix?
2
u/ebsf 3 26d ago
Check in the VBE to see whether a reference is set to Excel. I'm guessing, not. If that's the case, see whether you can set the reference, either by name in the list box, or by navigating directly to the relevant file. (I'm on my phone, so don't have that path or file name handy.)
1
u/SuchDogeHodler 26d ago
Check the security settings to make sure the vba model is trusted.
1
u/keith-kld 26d ago
If all efforts are made to the VBA reference but it still does not work, the issue may be derived from the libraries on Windows (or the framework, the environment and so forth). Please check it.