
- CONVERTING MAILING LIST FROM EXCEL TO WORD FOR LABELS CODE
- CONVERTING MAILING LIST FROM EXCEL TO WORD FOR LABELS WINDOWS
The ADODB Command is set and followed by the properties to indicate it is a Stored Procedure (not a SQL Select Statement), the Active Connection, and the Output Parameter By setting the ADODB Recordset to receive Command.Execute code, rs receives all of the Datasets in it and they may be retrieved by using a For Loop in the next section.
CONVERTING MAILING LIST FROM EXCEL TO WORD FOR LABELS CODE
'one code line to set the SQL connection string and openĬn.ConnectionString = "Provider=MSDataShape Data Provider=SQLOLEDB SERVER= DATABASE=AdventureWorks2014 Integrated Security=SSPI" 'set up the connection and Recordset as New Coding the Connection string is very simple with 1 line of code and then it is opened.ĭim labelrows, labelcolumns, i As Integerĭim j As Integer, k As Integer, t As Integer The ADODB connection, recordset, and a new ADODB Command are added as well as 2 additional integers x and y. The execution of the Stored Procedure in SSMS delivers the following output in the Results window.Ĭreate a new Module to write the Code to connect to the SQL Server database Stored Procedure. Variable is set to 1 for a While loop which will deliver the rows for each tID for each Vendor to the VBA code in Word. The final T-SQL code retrieves the count of vendors which is then provided to the OUTPUT variable in the Set statement. The main Temp table, #tmpVendor, is then updated with the sequential ID - the same type of ID manually added in the Excel version of this article. The next part of the Stored Procedure takes only the Vendor IDs and assigns the Row_Number of 1 through 80 to each unique Vendor ID in another Temp table. The Select statement pushes the Vendor & Purchase Order information into a Temp Table so that an sequential Vendor ID may be added. The stored procedure includes 1 output variable, which will tell the VBA code how many recordsets to expect to use in a For loop.
CONVERTING MAILING LIST FROM EXCEL TO WORD FOR LABELS WINDOWS
Windows Form Application - DataGrids & DataSetsĬode a stored procedure in SQL Server SSMS to use the query on the tables from the AdventureWorks2014 database.Access & GUID (uniqueidentifier) Data Type.Access DAO Creating Tables, Queries, Indexes.In the pop-up window, create a file name and save to either your “MyAvery Online Account” or your computer. To save your design, click the “Save” button. TIP: Follow the directions from the insert in the package for basic printing tips. When your design is ready to go, just click the green “Print” button. To make adjustments, just click the “Back” button in the upper-right-hand corner. Step 7: Preview & PrintĬlick “Preview & Print” to review your design. The Sheet Navigator on the right will also show you how the entire label sheet will appear. When you are satisfied with the appearance of your labels, click “Complete Merge.” You will see a sample of the first label with your information merged in with your design template.

You can insert commas, spaces, and other text, and these will remain where you insert them during the merge. To do this, just click the field name in the “Available fields” list on the left, hold the mouse button down, and drag the field over to the “Arrange fields” box on the right. Now it’s time to set up the appearance of your information as it will look on the labels.


If you used the first row of your file for column headings and do not wish to print it out, just click to remove the check mark from “Print this row of data.”Ĭlick “Next” to continue. If you don’t have a spreadsheet with all of your names and addresses, you can start with our pre-formatted files for Microsoft® Excel or other database programs. The file name will appear above the view area. Once it’s located, you should be able to view your file content on the screen. Step 5: Select a FileĬlick the green “Browse for File” button to locate the file from your computer that contains your mailing list. Then, select “Import Data (Mail Merge)” from the column on the left, and click the “Start Mail Merge” button. Now it’s time to bring your mailing list (or other list) and combine it with your label design.Ĭlick the text box where you would like the mailing address to appear on your label. Want to start from scratch? Choose the “Blank and Text Only” theme. Select from a variety of design themes from the column on the left, and view the design(s) from each theme on the right. Go to Avery Design & Print Online and enter the product number of your labels (such as “5160”) and press Enter Step 2: Confirm the Product TemplateĬlick the template that matches your product.
