Edit: Sorry, wrong thread, can somebody move to programming please?
Hello,
Looking for a little help here. Basically what I need to do is assign a macro to a button I create in VBA code. Ultimately what is happening in my program is:
I need a simple way for our program assistant to generate certain data in a fixed way so she can do a mail merge later on. The data she needs is stored in a SQL database. What I want to do is pull a list of SessionID's for her in column A, in column B create a Button that she can click and when clicked with create the excel document that she can use in her mail merge.
I have the SQL code done(for both sections, just showing part 1 now), now I just need to get my button to work. So far this is what I have.
The above code populates column A with the SessionID and column B with a button with the title 'Generate' however when I click the button I get this following error:![]()
Please Login or Register to view this content.
"Cannot run the macro 'Book2.xlsm!btnS'. The macro may not be available in this workbook or all macros may be disabled."
even though the btnS call at the end of my code works. Perhaps I am looking at this all wrong but any help would be greatly appreciated. I've spent a few hours scouring Google but nothing has helped so far.
Bookmarks