Excel VBA Programming - Getting Started | 4 - Excel File Types

Knowledge Clicks
24 Jan 202304:01

Summary

TLDRThis lesson explains the importance of saving Excel workbooks with macro code in the correct file format. The default '.xlsx' does not support macros, so it's crucial to use '.xlsm' to preserve code. The tutorial demonstrates how to save in '.xlsm' format and shows how to set this as the default to prevent accidental loss of macros. It also advises on toggling this setting based on Excel usage outside the course.

Takeaways

  • šŸ“š The default Excel file extension 'xlsx' does not support macro code.
  • šŸ”„ To preserve macro code, workbooks should be saved in a specific file type.
  • šŸ’” Use the 'Control Plus S' keyboard shortcut to access the save prompt in Excel.
  • šŸ“ The 'Excel Workbook' file type is the standard default, but it prohibits macros.
  • šŸš« Saving macros in a regular '.xlsx' file will result in a warning from Excel, and macros will be lost upon reopening.
  • šŸ”‘ The correct file format for macro-enabled workbooks is '.xlsm', which stands for 'macro'.
  • šŸŒŸ '.xlsm' files look and function the same as regular Excel workbooks but allow macros to be written and preserved.
  • šŸ› ļø Throughout the course, it's recommended to use the 'Excel Macro-Enabled Workbook' format for saving files.
  • āš™ļø There's an optional setting to change the default file type to '.xlsm' for ease of use in the course.
  • šŸ”„ The 'Excel Options' pane allows you to change the default save format to 'Excel Macro-Enabled Workbook'.
  • šŸ”„ This setting is global for Excel and can be changed back if needed for other uses outside the course.

Q & A

  • What is the default file extension for Excel workbooks?

    -The default file extension for Excel workbooks is 'xlsx'.

  • Does the 'xlsx' file extension support macro code?

    -No, the 'xlsx' file extension does not support macro code.

  • What is the recommended file type to save Excel workbooks containing macro code?

    -The recommended file type to save Excel workbooks containing macro code is 'xlsm', which stands for Excel Macro-Enabled Workbook.

  • What happens if you save macro code in an Excel workbook with the 'xlsx' extension?

    -If you save macro code in an Excel workbook with the 'xlsx' extension, Excel will give a warning that it does not support macros. If you ignore the warning and save, the macro code will be lost when the workbook is reopened.

  • How can you ensure your macro-enabled workbook is saved in the correct format?

    -To ensure your macro-enabled workbook is saved in the correct format, choose 'Excel Macro-Enabled Workbook' from the 'Save as type' dropdown when saving the file.

  • What is the keyboard shortcut to bring up the save prompt in Excel?

    -The keyboard shortcut to bring up the save prompt in Excel is 'Control Plus S'.

  • What is the difference between a regular Excel workbook and a macro-enabled workbook in terms of functionality?

    -A regular Excel workbook and a macro-enabled workbook have the same functionality. The only difference is that macro-enabled workbooks allow macros to be written and preserved.

  • How can you change the default save file type in Excel?

    -You can change the default save file type in Excel by going to 'File' > 'Options' > 'Save', then selecting 'Excel Macro-Enabled Workbook' from the 'Save files in this format' dropdown and clicking 'OK'.

  • Why might you not want to change the default save file type to 'xlsm' for all Excel uses?

    -You might not want to change the default save file type to 'xlsm' if you use Excel for purposes outside of macro programming, as it could lead to accidentally saving non-macro workbooks in a format that supports macros.

  • Is changing the default save file type a permanent setting in Excel?

    -No, changing the default save file type is a global setting in Excel, but you can change it back if needed for other uses.

  • What is the significance of the 'm' in the 'xlsm' file extension?

    -The 'm' in the 'xlsm' file extension stands for 'macro', indicating that the file format allows for the inclusion and preservation of macro code.

Outlines

00:00

šŸ“Š Excel File Types for Macros

The lesson focuses on the importance of selecting the correct file type in Excel to preserve macro code. The default Excel file extension 'xlsx' does not support macros, so a specific file type is necessary. The instructor demonstrates how to access the 'Save As' dialog and navigate to the 'Save as type' dropdown to choose 'Excel Macro-Enabled Workbook' with the '.xlsm' extension. This format allows macros to be written and preserved. The instructor also explains how to change the default save type to '.xlsm' in Excel options to streamline the process and prevent accidental loss of macro code.

Mindmap

Keywords

šŸ’”Excel

Excel is a widely used spreadsheet program developed by Microsoft for Windows, macOS, Android, and iOS. It is part of the Microsoft Office suite and is known for its ability to organize, analyze, and manipulate data using a grid of cells. In the video, Excel is the platform where the user is working with macros, indicating its use for more complex data management tasks.

šŸ’”File Types

In the context of the video, file types refer to the different formats in which an Excel workbook can be saved. Each file type has specific features and compatibility with certain functionalities, such as the ability to support macro code.

šŸ’”Macro Code

Macro code in Excel refers to a sequence of instructions that automate repetitive tasks within the program. It is written in a programming language such as VBA (Visual Basic for Applications). The script emphasizes the importance of saving macro-enabled workbooks in the correct file type to preserve this code.

šŸ’”Save

The save function in Excel is used to store the current state of a workbook to a file. The video discusses the importance of using the save function with the correct file type to ensure that macro code is not lost upon reopening the workbook.

šŸ’”Backstage View

The backstage view in Excel is a hidden menu that provides access to file management options, such as saving, opening, and printing. The script mentions pressing 'Control Plus S' to bring up the backstage view and access the save prompt.

šŸ’”VBA Course Folder

The VBA course folder mentioned in the script is a directory on the desktop where the user has unzipped the course files related to learning VBA in Excel. It serves as a workspace for the user to practice and save their macro-enabled workbooks.

šŸ’”Save As Type

This refers to the option in Excel that allows users to choose the file format in which they want to save their workbook. The script discusses the importance of selecting 'Excel Macro-Enabled Workbook' to preserve macro code.

šŸ’”Extension

An extension in computing is the suffix at the end of a file name that indicates the file type or format. In the script, 'xlsx' is the default extension for Excel workbooks without macro support, while 'xlsm' is used for macro-enabled workbooks.

šŸ’”Macro Enabled Workbook

A macro-enabled workbook is an Excel file that has the capacity to store and run VBA macro code. The script highlights that this type of workbook uses the '.xlsm' extension and is essential for users who work with macros.

šŸ’”Excel Options

Excel options refer to the settings within the Excel application that allow users to customize various aspects of the program. The script describes how to access these options to change the default file type to 'Excel Macro-Enabled Workbook' for convenience.

šŸ’”Default Save Type

The default save type is the file format that Excel automatically selects when the user saves a workbook. The video provides instructions on how to change this setting to 'Excel Macro-Enabled Workbook' to streamline the saving process for users working with macros.

Highlights

Default Excel file extension xlsx does not support macro code.

Workbooks must be saved in a specified file type to preserve and run macro code.

Using the keyboard shortcut Control Plus S brings up the save prompt.

The standard Excel workbook type prohibits macros, with xlsx as its extension.

Excel warns if you try to save macro code in a standard workbook.

Ignoring the warning can result in the loss of macro code upon reopening the workbook.

To preserve macros, workbooks should be saved as 'Excel Macro-Enabled Workbook' with the xlsm extension.

The 'm' in xlsm stands for macro, indicating macro-enabled workbooks.

Macro-enabled workbooks have identical functionality to regular Excel workbooks, with the added ability to write and preserve macros.

Throughout the course, the xlsm file format will be used for all workbooks.

Changing the default save type to xlsm simplifies the saving process and reduces errors.

Accessing the 'Options' in the backstage window allows for changing the default file type.

Selecting 'Excel Macro-Enabled Workbook' as the default save type ensures macros are preserved.

This setting change is a global Excel setting and can be reverted if needed.

Using xlsm as the default save type adds efficiency and prevents accidental loss of macro work.

The key takeaway is that all macro-enabled workbooks must have the xlsm extension.

Transcripts

play00:00

in this lesson I want to talk about the differentĀ  file types available in Excel as it turns out theĀ Ā 

play00:06

default Excel file extension xlsx does notĀ  actually support macro code so we'll need toĀ Ā 

play00:13

save our workbooks in a specified file type inĀ  order to ensure that our code is preserved andĀ Ā 

play00:17

that it can run the next time we open the workbookĀ  on my screen here I have a brand new unsaved ExcelĀ Ā 

play00:23

workbook so let's go ahead and get to the saveĀ  prompt I'm just going to press the keyboardĀ Ā 

play00:28

shortcut Control Plus s that'll bring us to theĀ  backstage View and in this case I'm just goingĀ Ā 

play00:34

to select anything that's going to bring up theĀ  save prompt we're not actually going to be savingĀ Ā 

play00:37

so it doesn't matter right now I'm just goingĀ  to bring up the VBA course folder on my desktopĀ Ā 

play00:42

where I asked you to unzip all of the course filesĀ  right down here we'll see this option save as typeĀ Ā 

play00:48

and you can see the option that's listed here isĀ  Excel workbook that is the standard default fileĀ Ā 

play00:54

type and in this standard default file type macrosĀ  are actually prohibited it looks like right hereĀ Ā 

play00:59

Excel is actually omitting the extension here butĀ  the extension for an Excel workbook a plain oneĀ Ā 

play01:05

is xlsx and it is no good if we write our macroĀ  code in here and then we save it Excel will giveĀ Ā 

play01:12

us a warning that says hey you're trying to saveĀ  macro code in here I don't support it if you forĀ Ā 

play01:17

some reason ignore that warning which is highlyĀ  likely because many times we just kind of saveĀ Ā 

play01:22

and click yes and don't actually read the promptĀ  on the screen if we accidentally save code in aĀ Ā 

play01:27

regular Excel workbook the next time we open itĀ  the code will be completely gone and all of ourĀ Ā 

play01:31

work will be lost so it's very important that weĀ  save our work in the proper format if we selectĀ Ā 

play01:35

this drop down what we really want to do is alwaysĀ  save our workbooks at least in this course in thisĀ Ā 

play01:41

format the Excel macro enabled workbook this has aĀ  file extension of xlsm you can always think of theĀ Ā 

play01:48

m at the end as being short for macro these macroĀ  enabled workbooks are identical to the regularĀ Ā 

play01:54

plain Excel workbooks they look exactly the sameĀ  they have all the same functionality the onlyĀ Ā 

play01:59

difference is that they allow macros to be writtenĀ  and preserved we're going to be sticking with thisĀ Ā 

play02:04

file format throughout the entire course so thereĀ  is one thing we can do to simplify the processĀ Ā 

play02:10

of choosing this option as the default save typeĀ  otherwise every single time you'll save a workbookĀ Ā 

play02:16

it's going to default to excel workbook and youĀ  might not properly save it in the right formatĀ Ā 

play02:20

it's a little bit of a hassle to keep selectingĀ  the right choice with that said if you're usingĀ Ā 

play02:25

Excel for other reasons outside this course youĀ  may not want to select this one as the default soĀ Ā 

play02:30

what I'm about to show you is an optional settingĀ  this is setting the default file type as xlsm youĀ Ā 

play02:36

don't have to do this but it's going to help makeĀ  the course a little bit easier and make sure thatĀ Ā 

play02:40

you don't have to remember to do this every singleĀ  time we save a file I'm going to quit out of myĀ Ā 

play02:45

save as window right here let's just click cancelĀ  and on the left side of my backstage window weĀ Ā 

play02:50

have this options option let's select it this isĀ  going to open up this Excel options pane it looksĀ Ā 

play02:57

like it took me back to excel as well and on theĀ  left side here I have save I want to select thatĀ Ā 

play03:02

and right here we see save files in this formatĀ  and the default xlsx extension is listed hereĀ Ā 

play03:08

that's the Excel workbook so if we want to changeĀ  the default save type we simply click this selectĀ Ā 

play03:15

Excel macro enabled workbook and click OK andĀ  that will from this point forward if I try toĀ Ā 

play03:20

save again ensure that the right file format isĀ  listed here we go I just brought up the save asĀ Ā 

play03:25

window and we can see it says macro enabledĀ  workbook now this is a global Excel settingĀ Ā 

play03:30

but you can go ahead and change it back if youĀ  ever need to again if you're using Excel forĀ Ā 

play03:34

other reasons and you don't want to accidentallyĀ  save your workbooks as macro enabled workbooks youĀ Ā 

play03:39

might not want to choose this optional setting butĀ  if you want to add a little bit of efficiency theĀ Ā 

play03:43

through to your progression throughout the courseĀ  this might be worth taking some time to enableĀ Ā 

play03:47

that's all there is to cover here the key takeawayĀ  is all workbooks that have macro code must haveĀ Ā 

play03:53

the Excel SM extension which is depicted hereĀ  with the file type Excel macro enabled workbook

Rate This
ā˜…
ā˜…
ā˜…
ā˜…
ā˜…

5.0 / 5 (0 votes)

Related Tags
Excel TipsMacro EnabledFile FormatsVBA CourseSave SettingsWorkbook PreservationMacro CodeDefault ExtensionExcel FunctionsCoding Tutorial