Cách Add Reference Trong Word / Top 13 # Xem Nhiều Nhất & Mới Nhất 6/2023 # Top View | Hoisinhvienqnam.edu.vn

Cách Sửa Lỗi Circular Reference Trong Excel

Khi xử lý bảng dữ liệu Excel, thông báo lỗi Circular Reference có thể xuất hiện ở từng ô hoặc khi bảng vừa được mở ra. Thực tế đây không hẳn lỗi trên Excel mà ở dạng thông báo, cảnh báo người dùng với nội dung chính có 1 vòng lặp trong công thức tính.

Hướng dẫn fix lỗi Circular Reference trong Excel

Thông báo lỗi vòng lặp trên Excel có nội dung There are one or more circular references where a formula refers to its own cell either directly or indirectly. This might cause them to calculate incorrectly. Try removing or changing these references, or moving the formulas to different cells.

Trong bảng này bạn sẽ thấy công thức tại ô F7 tham chiếu đến ô F7. Khi đó các công thức dùng trong các ô D7, C11 và D11 sẽ đều bị loại bỏ kết quả.

Bước 1:

Khi xảy ra thông báo trên, trước hết chúng ta nhấn vào mục Formulas rồi chọn nhấn tiếp vào Error Checking.

Bước 2:

Hiển thị danh sách menu nhấn chọn Circular References chỉ dẫn để kiểm tra lại công thức, loại bỏ các tham chiếu gây vòng lặp trong công thức đó. Bạn sẽ nhìn thấy ngay vị trí lỗi vòng lặp đó trong bảng Excel. Sau khi biết được vị trí bạn tiến hành xóa, chuyển công thức, sửa lại tham chiếu trong công thức.

Như vậy lỗi vòng lặp đã được sửa.

Trong trường hợp người dùng bắt buộc phải sử dụng vòng lặp để tính toán thì cũng có thể xác lập số vòng lặp tối đa khi sử dụng. Nhấn vào File trên giao diện Excel rồi chọn Options trong menu bên trái giao diện. Tiếp đến trong nội dung mới nhấn vào mục Formulas.

Nhìn sang nội dung bên phải người dùng tích chọn vào Enable iterative calculation để sử dụng tính toán lặp. Bên dưới phần Maximum Iterations là số tối đa vòng lặp được sử dụng. Nhấn OK để lưu lại.

Như vậy việc sử dụng vòng lặp trong Excel cũng có thể xảy ra tùy thuộc vào nội dung dữ liệu Excel mà bạn đang xử lý. Nếu muốn dùng vòng lặp thì trước hết bạn cần phải kích hoạt tùy chọn cho phép dùng vòng lặp trong giao diện Options trên Excel.

Word 2013 Cheat Sheet: Ribbon Quick Reference

File tab/backstage

Rather than making changes within a document, this area lets you work with a document and Word overall. You’ll find common tasks such as opening, saving and printing a document, as well as special screens for managing the document, customizing Word and managing your Office account.

Home tab

This tab contains the most-used Word features, such as tools for changing fonts and font attributes, customizing paragraphs, using styles, and finding and replacing text.

Insert tab

Design tab

This tab lets you work with a document’s overall design, from choosing a pre-designed template or theme to customizing colors, fonts, paragraph spacing and more. It’s new to Office in 2013, and some of its commands are similar to those found on the Home tab and Page Layout tab. But there’s an overall difference: The Design tab is for changes affecting the entire document, and the other two tabs are generally for changes in individual parts of the document, like paragraphs.

Page Layout tab

Here’s where you change margins and page size and orientation, set up columns, align objects, add effects and so on. There are some gray areas between this tab, the Home tab and the Design tab. For example, on the Page Layout tab you set indents and spacing between paragraphs, while on the Home tab you set paragraph alignment and spacing between lines.

And while some commands are shared with the Design tab, the changes you make on the Page Layout tab generally affect individual paragraphs or sections of the document you’ve selected, whereas changes you make on the Design tab affect the entire document.

References tab

This tab handles tables of contents, footnotes, bibliographies, indexes and similar material. It also lets you insert a “Table of Authorities,” which sounds like something straight out of a Soviet bureaucracy but in fact is a list of references used in legal documents.

Mailings tab

As the name says, this is where you’ll go for anything to do with mailings, from something as simple as creating labels to the more daunting task of mail merges.

Review tab

Need to check spelling and grammar, look up a word in a thesaurus, work in markup mode, review other people’s markups or compare documents? This is the tab for you.

View tab

Here’s where to go when you want to change the view in any way, including displaying a ruler and grid lines, zooming in and out, splitting a window in two and so on.

Contextual tabs

Some tabs are not part of the basic Ribbon but appear only in certain contexts. For instance, the Picture Tools/Format tab appears only when you’ve inserted an image into your document and your cursor is positioned in the image area. It lets you do everything from cropping the image to positioning it on the page.

When you insert a table into your document and position your cursor in it, two new tabs appear: Table Tools/Design and Table Tools/Layout. The Design tab lets you control the table’s style, including borders and shading, while the Layout tab lets you specify the number of rows and columns, merge and split cells, sort the table’s data and more.

Similarly, when you insert a chart into your document and position your cursor in it, you see the Chart Tools/Design and Chart Tools/Format tabs. The Design tab lets you set what the chart looks like and what data appears in it, and the Format tab lets you control how it integrates with the page and do things such as change the styles of the shapes and lines in the chart.

Following are some of the most commonly used commands from these contextual tabs. Note that the keyboard shortcuts only work if your cursor is in the picture, table or chart.

See our Word 2013 cheat sheet to get the most out of Word 2013.

Copyright © 2015 IDG Communications, Inc.

How To Add, Modify, Or Delete A Table In Microsoft Word

How to add, modify, or delete a table in Microsoft Word

You can insert a table in a Microsoft Word document to display data in a tabular format. A table is a great way to represent multiple fields of associated data. For example, a list of prices is easier to read when displayed in a table.


You can also create a table in Microsoft Excel and then copy and paste that table in a Microsoft Word document, keeping all the same formatting. See: How to insert and customize a table in Microsoft Excel.

Adding a table in Word

In Word, place the mouse cursor where you want to add the table.

Inserting or deleting a row or column

In a Microsoft Word table, you can add or remove a row or column at any time.

Insert a row

Move the mouse cursor inside the left edge of a cell in the row where you want to insert a new row. The cursor changes to a small black arrow pointing to the top-right.

Insert a column

Move the mouse cursor inside the left edge of a cell in the column where you want to insert a new column. The cursor changes to a small black arrow pointing to the top-right.

Delete a row

Move the mouse cursor inside the left edge of a cell in the row you want to delete. The cursor changes to a small black arrow pointing to the top-right.

Delete a column

Move the mouse cursor inside the top edge of the top-most cell in the column you want to delete. The cursor changes to a small black arrow pointing downward.

Moving the table

Resizing the table

Changing the look of the table

Repeat header row of the table on each page

If the table spans more than one page, you may want to have the header row displayed on each additional page the table spans across. You can make the header row visible on each page by following the steps below.

Deleting a table

If you want to delete a table from a Word document, follow the steps below.

Move your mouse cursor over the table you want to delete.

    Additional information

    See our table definition for further information and related links.

    Microsoft Word help and support.

Office Space: From Vba Macro To Word Add

Office Space

From VBA Macro to Word Add-in

Robert Bogue

Code download available at: OfficeSpace2008_05.exe(166 KB)


Book Learning Macro Basics Moving Macros to VSTO Writing New Add-In Code More Buttons

Document automation isn’t a new functionality by any means. It has been going on since the invention of macros, and there has been a full-fledged programming model within Microsoft® Office applications since the early 1990s. For many years, the Office tools have featured macro recorders that weren’t limited to simply replaying keystrokes but have been capable of writing code on the fly as well. Macros have even demonstrated that they are functional enough to write viruses. And while writing a virus using a Word macro may be a dubious feat, it is a feat nonetheless.

However, even with all of the capabilities of Visual Basic® for Applications (VBA), there are some things it just doesn’t do very well. In the early days of VBA, XML hadn’t yet been invented, the Internet was in its infancy, and the first HTML pages were just beginning to appear. As such, it’s no wonder that making a Web service call isn’t well handled in the context of Visual Basic for Applications.

The Microsoft .NET Framework CLR, on the other hand, understands these technologies quite well. The ability to call Web services is just one among a number of reasons for wanting to write .NET-targeted code rather than VBA-and doing so means using Visual Studio® Tools for Office (VSTO). But switching from VBA to VSTO doesn’t have to be a case of throwing the baby out with the bath water; rather, it can be just a natural way to extend how you are already developing solutions in Office.

In this column you’ll see how to use Word to capture some VBA code that solves a basic problem. Then I will use the latest version of VSTO included with Visual Studio 2008 to wrap this code into a deployable Word add-in. I’ll also write some simple code for some of the tasks that the macro recorder either just can’t record or doesn’t record in an optimal way.

Book Learning

Recently, I found myself in a situation where this kind of VBA-to-VSTO conversion was perfect for the problem at hand. I was finishing my latest book, The SharePoint Shepherd’s Guide for End Users. The book is self-published, and I needed to output the manuscript from Word into a PDF that the printer could use. For that to work, there were several steps I first needed to complete to get the manuscript ready.

First, I had to assemble multiple files into one large document. With more than 140 individual files representing 13 sections and 116 tasks, munging them together wasn’t something I wanted to do by hand. Having so many individual files was great when working with Microsoft SharePoint® because it allowed for individual tracking of each task through the editorial workflow, but the sheer number made assembly a task best handled by automation.

Second, I wanted to make sure that all of the tracked changes in all of the documents had been accepted. During the editing process, I used revision marks (via the Track Changes feature in Word) to keep track of editing and other changes to the manuscript. The revision marks are supposed to all be accepted as part of the final checkout of the content, but if I missed some, the formatting of the revision marks would stand out in the final book, which wouldn’t be very professional looking.

I am going to illuminate the process of creating each of these pieces and the relative ability of the macro recorder to capture the code needed for each function. I’ll start by using the recorder to generate the basic automation code. From there I’ll take a closer look at workable but sub-optimal generated code. Finally, I’ll look at the recorder not generating code at all. I’ll convert the VBA code into VSTO code and put it into a Word add-in that I can use to assemble the final book. Just to make the process more challenging, I’ll convert the code from VBA to C# in the course of bringing it into VSTO.

Macro Basics

Figure 1** Enabling the Developer Tab in the Ribbon **

Figure 2** Record a Macro from the Developer Tab **

Figure 3** Naming the Macro **

Figure 4 AddFiles VBA Macro

Sub AddFiles() ' ' AddFiles Macro ' ' ChangeFileOpenDirectory _ "https://sharepoint.contoso.com/sites/sharepoint/" & _ "Shared%20Documents/SharePoint%20Tasks/" chúng tôi fileName:= _ "https://sharepoint.contoso.com/sites/SharePoint/" & _ "Shared%20Documents/SharePoint%20Tasks/" & _ "Task001%20-%20Create%20a%20Team%20Web%20Site.docx", _ ConfirmConversions:=False, _ ReadOnly:=False, _ AddToRecentFiles:=False, _ PasswordDocument:="", _ PasswordTemplate:="", _ Revert:=False, _ WritePasswordDocument:="", _ WritePasswordTemplate:="", _ Format:= wdOpenFormatAuto, _ XMLTransform:="" Selection.WholeStory chúng tôi chúng tôi Template:="Normal", NewTemplate:=False, DocumentType:=0 Selection.PasteAndFormat (wdPasteDefault) End Sub

Notice that there is an extraneous line that resets the next File Open directory. After that you see the Open command, and then there’s the series of commands to copy the text, create a new document, and paste the text into the new document. The code that the macro recording produced isn’t perfect, but it isn’t bad either. So I’ll take that, enhance it, and put it into VSTO.

Moving Macros to VSTO

To get started with VSTO, I first create a Word 2007 Add-in project. I open Visual Studio, start a new project, use the Word 2007 Add-in template for the project, and name the project PublishPrep. Upon successful creation of the new VSTO project, your Visual Studio 2008 environment should look similar to Figure 5.

Figure 5** New Word Add-In Project **

With the project created, I need to create a way for users to access the functionality in the add-in. For 2007 Office system applications, that means creating a Ribbon tab and buttons. First, add a new item to your project and select the Ribbon (Visual Designer) template from the Add New Item dialog. Name your new ribbon PublishPrep.

The next step is to customize the Ribbon. In this case, I’m just going to create a group that will live on the Add-ins tab instead of adding my own tab to the Ribbon. My group will contain three buttons.

Figure 6** Configuring the PublishPrep Ribbon **

Open the toolbox, scroll down to the Office Ribbon Controls group, and drag three button controls over onto the Publishing Preparation group. Note that the buttons will stack vertically by default.

Figure 7** Buttons and Group Configured for the Add-In **

Writing New Add-In Code

The first part of the code, a function called AppendFile (see Figure 8), takes a single parameter, the file name. At a quick glance the code doesn’t resemble the code the macro recorder wrote for me, but that’s mostly an illusion.

Figure 8 AppendFile

void AppendFile(string file) { if (string.IsNullOrEmpty(file)) return; Application app = Globals.ThisAddIn.Application; Document activeDoc = app.ActiveDocument; if (activeDoc == null) return; object fileObj = file; object confirmConversions = false; object readOnly = true; object addToRecentFiles = false; object passwordDocument = Missing.Value; object passwordTemplate = Missing.Value; object revert = true; object writePasswordDocument = Missing.Value; object writePasswordTemplate = Missing.Value; object format = Missing.Value; object encoding = Missing.Value; object visible = false; object openAndRepair = false; object documentDirection = Missing.Value; object noEncodingDialog = Missing.Value; object xMLTransform = Missing.Value; Document newDoc = app.Documents.Open(ref fileObj, ref confirmConversions, ref readOnly, ref addToRecentFiles, ref passwordDocument, ref passwordTemplate, ref revert, ref writePasswordDocument, ref writePasswordTemplate, ref format, ref encoding, ref visible, ref openAndRepair, ref documentDirection, ref noEncodingDialog, ref xMLTransform); app.Selection.WholeStory(); app.Selection.Copy(); activeDoc.Select(); object collapseEnd = WdCollapseDirection.wdCollapseEnd; app.Selection.Collapse(ref collapseEnd); app.Selection.Paste(); object saveChanges = WdSaveOptions.wdDoNotSaveChanges; object originalFormat = WdOpenFormat.wdOpenFormatAuto; object routeDocument = Missing.Value; newDoc.Close(ref saveChanges, ref originalFormat, ref routeDocument); object breakType = WdBreakType.wdPageBreak; app.Selection.InsertBreak(ref breakType); }

The first four lines just get the active document and perform error checking. If there’s no active document, you can’t exactly append to it, and if you don’t have a file name to append, there’s not much more you can do. The other thing that these lines are doing is getting references to the application-which is assumed in VBA-and the active document when the button method was called, something the recorded version of the macro didn’t need to do.

The next set of lines-the object variable declarations-are necessary because of the way C# makes the call to the COM components that Word exposes. I need to specify missing values, and since the values are all passed by reference, I need a variable to hold them.

The code then performs the same copy operation that the macro recorder generated. The real difference here is that my add-in code is responsible for the management of the active document, including making sure that the cursor position is set to the end of the active document.

The final block of code closes the document I opened, making sure not to save any changes. It also adds a page break after the inserted content because I want to make sure that the contents of the individual files don’t run together.

The second part of the code actually gets the list of files to assemble and calls AppendFile (see Figure 9). This isn’t code that the macro recorder captured, but it is where you see the power of VSTO because it allows you to leverage all of the .NET constructs. In this case, I’ll leverage the OpenFileDialog control, the ability to open and read from a text file, the use of generics to create a list of files, and calling another smaller method that iterates through the list.

Figure 9 VSTO Power Behind the Button

using Microsoft.Office.Interop.Word; using chúng tôi using System.Reflection;

Finally, replace the method stub created by Visual Studio with the code in Figure 9.

More Buttons

Figure 10** Enabling the Developer Tab in the Ribbon **

Sub AcceptAllChanges() ' ' AcceptAllChanges Macro ' WordBasic.AcceptAllChangesInDoc End Sub

The macro recorder recorded this action to use the WordBasic object. The WordBasic object is a holdover from before Word macros were modified to use VBA. It’s not the best way to approach the problem. It’s much better to use ActiveDocument. You can either employ the AcceptAllRevisions method or the Revision property’s AcceptAll method. I slightly prefer the Revisions.AcceptAll nomenclature, but either method works.

Here is the code necessary to accept revisions from within VSTO code:

One interesting thing to note is that the indexer here is 1-based, not zero-based as you would expect in C#.

Robert Bogue, Microsoft MVP for Microsoft Office Sharepoint Server, MCSE, and MCSA:Security, has contributed to more than 100 book projects and numerous other publishing projects. Robert blogs at chúng tôi you can reach him at Rob.Bogue@thorprojects.com. Find out more about his latest book project, The SharePoint Shepherd’s Guide for End Users, at sharepointshepherd.com.