Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default VB Project Error

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default VB Project Error

Hi
in Excel goto 'Tools - Macros - Security' and on the second tab allow access
to the VBA projects

--
Regards
Frank Kabel
Frankfurt, Germany

Anson wrote:
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



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default VB Project Error

Hi Anson

See
http://www.j-walk.com/ss/excel/tips/tip96.htm

--
Regards Ron de Bruin
http://www.rondebruin.nl


"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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
VBE Error (Project unviewable) Tia[_3_] Excel Worksheet Functions 0 July 24th 08 10:28 AM
Can't Find Project or Library Error Vick Excel Discussion (Misc queries) 1 May 17th 08 12:25 PM
Excell error "Can't find Project or Library" Project VBAProject Lost in Excel Excel Worksheet Functions 0 April 12th 07 04:42 PM
can't find project or library - error Chris T-M New Users to Excel 4 January 18th 07 10:23 PM
help with this error-Compile error: cant find project or library JackR Excel Discussion (Misc queries) 2 June 10th 06 09:09 PM


All times are GMT +1. The time now is 01:56 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"