Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,872
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 852
Default 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
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 09: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 11: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 10:11 PM.

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"