Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macros not enabled
Hi Howard,
Am Sat, 2 Apr 2016 12:45:06 -0700 (PDT) schrieb L. Howard: 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. save the files in a trusted location or try: Options = Trust Center = Trust Center settings = Trusted Locations and add the path. Regards Claus B. -- Vista Ultimate / Windows7 Office 2007 Ultimate / 2010 Professional |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macros not enabled
save the files in a trusted location or try:
Options = Trust Center = Trust Center settings = Trusted Locations and add the path. Regards Claus B. Adding the path did the trick. That is an area I have always just used the default setting because of the lack of trust I have in myself to do the correct thing in the Trust Center. Thanks Claus, its working now. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
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 |