View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default VB Project Error

In tools=Macros=Security, go to the Trusted tab and make sure the checkbox
in the lower left corner (trust access to visual basic project) is checked.

--
Regards,
Tom Ogilvy

"Anson" wrote in message
...
I am trying to update a macro with a macro this is the error that I

received:

"Programmatic access to Visual Basic is not trusted"

Any assistance will be greatly appreciated. Thanks!

Here are the codes:

Sub Patch_2()
'Change Import Module Line 80, Column 63 from "16" to "15"

Dim MPivot As Range
Dim CurrBook As Workbook, FName As String, FPW As String
Dim iBook As Integer, InsertItem As String

Dim FileProject As Object, FileModule As CodeModule

Set MPivot = ThisWorkbook.Sheets("D").[A8]
InsertItem = " MPivot.Offset(iInc, 15) = IPivot.Offset(iImport,
15) 'Eligibility"


iBook = 1
Do While IsEmpty(MPivot.Offset(iBook, 0)) = False

FName = ThisWorkbook.Sheets("D").[A3] & MPivot.Offset(iBook, 0)
FPW = MPivot.Offset(iBook, 2)
Set CurrBook = Workbooks.Open(Filename:=FName, Password:=FPW)
Set FileProject = CurrBook.VBProject
Set FileModule = CurrBook.VBProject.VBComponents("M_Import")

FileModule.DeleteLines 80, 1
FileModule.InsertLines 80, InsertItem

iBook = iBook + 1

Set CurrBook = Nothing
Set MPivot = Nothing
Set FileModule = Nothing

Loop

End Sub