Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Ensuring Macros Are Enabled | Excel Programming | |||
choose default macros Not Enabled / Macros Enable Setting | Excel Programming | |||
Enabled macros | Excel Programming | |||
Open workbook-macros enabled, opening another with macros | Excel Programming | |||
How to have macros enabled at start | Excel Programming |