View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.programming
Vacuum Sealed Vacuum Sealed is offline
external usenet poster
 
Posts: 259
Default VBA code won't run, even with Macro Security set to Enable All Macors

Hi Brian

In the VBE Window in the left hand pane, you will see ThisWorkbook.

On the Toolbar/Ribbon, goto Insert|Module.

Module1 will appear just under ThisWorkbook, doubleclick it and the right
pane will open up allowing you to enter Functions and Sub Routines.

Using something like the following should help open your workbook, modify to
suit.

Sub Export_PODs()

Dim myWB As Workbook

With Application
.ScreenUpdating = False
End With

On Error Resume Next
Set myWB = Workbooks("myWB.xls")
On Error GoTo 0
If myWB Is Nothing Then
Set myWB = Workbooks.Open("C:\YourFolder\myWB.xls")
End If

Windows("myWB.xls").Activate

With Application
.ScreenUpdating = True
End With

Garry will more than likely jump in, hopefully adding some very helpful code
to disable the Macro Security.

HTH
Mick