LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 852
Default Macros not enabled

I run this macro in my workbook and it lists all my Excel workbooks I keep in archive Documents folder.

Sub GetFileNames()
Dim xRow As Long
Dim xDirect$, xFname$, InitialFoldr$
InitialFoldr$ = "C:\" '<<< Startup folder to begin searching from

With Application.FileDialog(msoFileDialogFolderPicker)
.InitialFileName = Application.DefaultFilePath & "\"
.Title = "Please select a folder to list Files from"
.InitialFileName = InitialFoldr$
.Show
If .SelectedItems.Count < 0 Then
xDirect$ = .SelectedItems(1) & "\"
xFname$ = Dir(xDirect$, 7)
Do While xFname$ < ""
Range("B2").Offset(xRow) = xFname$
xRow = xRow + 1
xFname$ = Dir
Loop
End If

End With
End Sub


I select a workbook name on the sheet and run this macro to open that workbook.

Sub OpenFile()

Dim myBook As String
myBook = ActiveCell.Value

Dim myCheck
myCheck = MsgBox("Open? " & vbCr & vbCr & myBook, vbYesNo)

If myCheck = vbNo Then
Exit Sub

Else
Workbooks.Open Filename:= _
"C:\Users\ffff\Documents\" & myBook

End If

End Sub


All this works fine, however, the macros are not enabled in any of the workbooks opened from the list. I can run a snippet macro to EnableEvents on the workbook and then the macros run okay.

If I open the same workbook from the Documents folder, the macros are enabled.

Don't know what to do make the macros enabled from the sheet selection/opening.

Thanks,
Howard
 
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
Ensuring Macros Are Enabled TSW632 Excel Programming 3 November 2nd 10 08:02 PM
choose default macros Not Enabled / Macros Enable Setting BEEJAY Excel Programming 2 June 30th 06 01:07 PM
Enabled macros raw[_13_] Excel Programming 1 December 14th 05 10:59 AM
Open workbook-macros enabled, opening another with macros George J Excel Programming 5 September 17th 04 02:07 PM
How to have macros enabled at start Bill D.[_2_] Excel Programming 3 April 16th 04 12:16 AM


All times are GMT +1. The time now is 02:47 PM.

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

About Us

"It's about Microsoft Excel"