How do I enable macros in Excel current workbook?

How do I enable macros in Excel current workbook?

I have a .

Xls file that I wish to open using the method shown in this post, except that when it opens, all the data is highlighted in purple with a macro active state. I have searched the web and forums to try to figure out how to enable/disable macros from one workbook to another and haven't been able to find anything.

For your information, both workbooks open fine on my laptop using Windows 8 64bit and the method in that link works fine. Code for opening the second workbook and saving as a new format: Sub SetMacros(). Dim MyPath As String, Path As String. MyPath = "D:Program FilesMicrosoft Office". Path = "". 'Set name of file without extension to get file format information. ActiveSheet.Cells(3, 2) = "FileName" ActiveSheet.Cells(3, 3) = FileName & ".Format."
ActiveWorkbook.SaveAs Filename:=MyPath & "Folder" & FileName & "."
, FileFormat:=xlExcel8MacroEnabled, Password:="xxxx", WriteResPassword:="xxxx". ActiveWorkbook.Close End Sub. How do I enable macros? Thank you. If you don't want to have macros enabled in the other workbook, and if you don't want to have any VBA code in the first one, you could try writing a simple VBA routine that will save the settings of that workbook before opening it. For example, in your macro (with any name that you like): Public Sub InitSomething(). Dim x As Object. Set x = ThisWorkbook. x.Save That is all. Now, whenever you open the other workbook (or open a copy/save in another location), the InitSomething() macro will run (if it exists in the current module).

Update: In order to keep things in the same module, you can use the Open event to call this routine and then save again (or do nothing): Private Sub WorkbookOpen(). If IsError(Me.

How do I enable the macros in Excel?

I'm trying to use Excel macros to automate some of my spreadsheets.

What I would like to do is import a .txt file into a worksheet and have it auto fill in the next few cells with dates and a few other values.

I've tried using the function: Function import(filename). Dim importworkbook As Workbook. 'Set importworkbook = Workbooks.Open(filename) 'Import values from file into the first worksheet. With ActiveSheet. .Cells(1, 1).Select
.Cells(1, 1) = Filepath .Cells(1, 2) = Filename .Cells(1, 3) = Filesize .Cells(1, 4) = Filetype .Cells(1, 5) = Datemodified .Cells(1, 6) = Datecreated .Cells(1, 7) = Timecreated .Cells(1, 8) = Timemodified .Cells(1, 9) = Authorname .Cells(1, 10) = Authoremail End With. End Function. As well as putting the same import function into a cell and running it via the "run" option but it seems to be ignoring the imported values. I also tried using the macro recorder but that does not seem to work with imported functions. Is there any way to get this working or am I stuck using macros to write scripts? The macro recorder will only work for recorded macros. If you have already created a macro then just create a new sheet and record your new macro, then save the new macro. Then just run the new macro.

Related Answers

How do I disable macros in group policy?

This article provides a step-by-step guide to turn off macros in Of...

Does Excel 2016 have Macros?

After I used the Microsoft Office Assistant tool to clean up my Excel spreads...

Is Excel macro a skill?

In the past couple of years I've noticed people refer to two...