I have the following code that should copy a macro in the current workbook to another workbook I just created from VBA code.
Const MODULE_NAME As String = "ShowE" ' Name of the module to transfer
Const TEMPFILE As String = "c:\Modul.bas" ' temp textfile
Rem ** export the module to a textfile
Application.Workbooks(WBN).VBProject.VBComponents("ShowE").Export TEMPFILE
'import the module to the new workbook
Application.Workbooks(WBNameX).VBProject.VBComponents.Import TEMPFILE
'kill the textfile
Kill TEMPFILE
I get the following error message:
Run-Time error '1004'
Programmatic access to Visual Basic Project is not trusted
I think I need to make a self-signed certificate but I am not sure how to do it from Powershell.
I am running Windows 10 and Powershell should be built-in.
Const MODULE_NAME As String = "ShowE" ' Name of the module to transfer
Const TEMPFILE As String = "c:\Modul.bas" ' temp textfile
Rem ** export the module to a textfile
Application.Workbooks(WBN).VBProject.VBComponents("ShowE").Export TEMPFILE
'import the module to the new workbook
Application.Workbooks(WBNameX).VBProject.VBComponents.Import TEMPFILE
'kill the textfile
Kill TEMPFILE
I get the following error message:
Run-Time error '1004'
Programmatic access to Visual Basic Project is not trusted
I think I need to make a self-signed certificate but I am not sure how to do it from Powershell.
I am running Windows 10 and Powershell should be built-in.