UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Running Excel Vba Within Ms Access, Access 2013    
 
   
AAJONES3
post Oct 7 2019, 02:37 PM
Post#1



Posts: 5
Joined: 4-October 19



I have the following code that opens my Excel file and is supposed to run the Sub called "ClearContents12"; however, I receive the following error: Error Number: 1004 Cannot run the macro ... The macro may not be available in this workbook or all macros may be disabled. I'm assuming it's not enabling the macros when it opens the .xlsm file. Is there a way to enable those in the background?



xlApp.Run FileName & "!" & MacroName


This post has been edited by AAJONES3: Oct 7 2019, 02:51 PM
Go to the top of the page
 
theDBguy
post Oct 7 2019, 02:42 PM
Post#2


Access Wiki and Forums Moderator
Posts: 76,416
Joined: 19-June 07
From: SunnySandyEggo


Hi. Since you already opened the workbook, have you tried simply running the macro name? For example:
CODE
xlApp.Run sMacroName

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Access Website | Access Blog | Email
Go to the top of the page
 
AAJONES3
post Oct 7 2019, 02:50 PM
Post#3



Posts: 5
Joined: 4-October 19



Well that was easy enough lol - thankyou:)
Go to the top of the page
 
theDBguy
post Oct 7 2019, 02:51 PM
Post#4


Access Wiki and Forums Moderator
Posts: 76,416
Joined: 19-June 07
From: SunnySandyEggo


Hi. You're welcome! Glad to hear you got it to work. Good luck with your project.

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Access Website | Access Blog | Email
Go to the top of the page
 


Custom Search


RSSSearch   Top   Lo-Fi    22nd October 2019 - 09:54 AM