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
> Creating An Excel Document With Vba Code Enable Access, Access 2013    
 
   
slacka
post Feb 4 2020, 04:39 PM
Post#1



Posts: 30
Joined: 2-December 17



Hi,
I'm exporting some data from access to an excel document using VBA.

What I would like to do is also add a VBA module event to a worksheet in my excel file but I'm getting the error. "Programmatic access to visual basic project is not trusted".

It seems you can tweak the security setting for this in trust center in Excel. Can anyone point me to how I would do that via VBA. Lol

This line is what throws the error.
Set obvb = objExcel. Activeworkbook.vbproject.vbcomponents("Sheet1").codemodule
Go to the top of the page
 
Doug Steele
post Feb 4 2020, 05:00 PM
Post#2


UtterAccess VIP
Posts: 22,246
Joined: 8-January 07
From: St. Catharines, ON (Canada)


Seems to me that it would be a pretty big security issue if you could adjust the Trust Center settings through VBA...

--------------------
Doug Steele, Microsoft Access MVP (2000-2018)
Personal webpage
Microsoft profile
Co-author: Access Solutions: Tips, Tricks, and Secrets from Microsoft Access MVPs, published by Wiley
Co-author: Effective SQL: 61 Specific Ways to Write Better SQL, published by Addison-Wesley Professional
Technical Editor: Access 2010 Bible, Access 2013 Bible, Access 2016 Bible, all published by Wiley
Technical Editor: SQL Queries for Mere Mortals: A Hands-On Guide to Data Manipulation in SQL, 4th Edition, published by Addison-Wesley Professional
Go to the top of the page
 
slacka
post Feb 4 2020, 05:05 PM
Post#3



Posts: 30
Joined: 2-December 17



I found an example where someone uses sendkeys to do it, I'm assuming this is within an excel docent though. So guessing it's not possible. If it was, the setting would be kind of pointless I suppose.
Go to the top of the page
 
WildBird
post Feb 4 2020, 05:31 PM
Post#4


UtterAccess VIP
Posts: 3,724
Joined: 19-August 03
From: Auckland, Little Australia


Usual way would be to add it to a 'template' Excel file with the code already in it.

--------------------
Beer, natures brain defragging tool.
Go to the top of the page
 
slacka
post Feb 14 2020, 03:16 AM
Post#5



Posts: 30
Joined: 2-December 17



yeah, that's what i ended up doing in the end.
Go to the top of the page
 


Custom Search


RSSSearch   Top   Lo-Fi    23rd February 2020 - 12:52 PM