Add item to existing Sharepoint list from excel - vba

I have a existing sharepoint list naming (Emp DB) which contains below fields
EmpID:
Emp Name:
Supervisor:
emailID:
Contact:
i want to add items frequently to the above list from excel sheet contains same fields as a columns. VBA coding is required...
Any help on this is very much appreciated....

The datasheet view is not a good way to do this. Either you use VBA and macro from excel or access to update the list. The problem I have is the exact same but with lookup columns to filter the form used to add a new object. When the cut and paste is done from excel the list can't figure out which column value to use and connect it to the value from another list.
I have also heard that you could use web services in SharePoint but i haven't got there yet. Here are some articles that may help you regarding VBA:
https://scottlyerly.wordpress.com/2014/06/26/excel-geeking-using-vba-and-ado-to-change-data-to-sharepoint-lists/
https://flylib.com/books/en/3.464.1.67/1/
https://sharepoint.stackexchange.com/questions/11426/update-list-from-excel-using-vba

Make sure that your list view and excel sheet columns are in the same order. Click the edit link inside "new item or edit this list" at the top of your list page. Now your list is in "datasheet view." Highlight the rows from excel that you want to enter and copy them. On your list page, click the leftmost cell of the empty row at the bottom, and do CTR+V. This should prompt you to "Allow Access" to your clipboard and paste your new entries onto the list.
If you have any trouble see this guide.

Related

Can I copy an ENTIRE Excel sheet and paste to another Excel spreadsheet using Power Automate. (Sharepoint)

I am working from SharePoint.
I would like to COPY AN ENTIRE Excel Sheet-A from Spreadsheet A and Paste it into another Sheet, Sheet-B on Spreadsheet B using Microsoft Power Automate.
Some important things to note:
Sheet-A does not have column names (I know).
There are no Key values or Key Columns. Just random information.
Is there a way to go about this?
Unfortunately PowerAutomate really wants you to have your information in a table if you want to move or manipulate the data and wouldn't it be so useful to have a "Duplicate Sheet" function and copy n paste of individual cells.
If your sheet with the random data happened to be in a single large table, then this may work by apply to each item when navigating the underlying table.

Using VBA to create a dynamic query after importing a SQL database table in MS Excel

This is a problem that has stumped me for a couple of days, and one I've been trying to work on. Unfortunately I very new to working on this stuff, and don't have a lot of resources trying to solve this problem, so if I am unclear or you have a question please post a comment about it.
The problem I am trying to tackle is this:
After getting external data from a SQL Server and having a table in a spreadsheet, say the is called Products, and has columns for productid (column A), productname (column B), supplierid (column C), and categoryname (column D). Is there a way to define a cell, say E1 where you use can use VBA to create a dynamic query. In this dynamic query you would enter some value of categoryname where it would query the table, and give you the results?
It is possible to perform a dynamic query without using any VBA.
Base your table on "From Microsoft Query" (under the "Get External Data" group on the Data tab). Build your query using the Query Wizard, selecting the table columns of interest. On the "Query Wizard - Filter Data" tab, where you would normally say a particular column must have a specific value, instead of the specific value, use just a question mark (for any and all columns that need to be used to filter). When you return your data to Excel, you will be prompted to "Enter Parameter Value" for each ? you used. Just click OK at this stage.
When the Excel "Import Data" dialog appears, click "Properties...". On the Definition tab click the button labelled "Parameters...". For each parameter, choose to "Get the value from the following cell" and to "Refresh automatically when cell value changes". Click the red arrow button (to select a cell) and click in the cell where each parameter will get its value from.
It's a good idea to have a label alongside each cell, and maybe special formatting for the data entry cell. The results table can be on the same worksheet as the parameter entry cells, when you enter a value in the entry cell, a new query will be run and the result will be displayed.
Here is a link that might help.
It goes into using VBA to filter.
I found it a while ago when I looked for something similar, hope it helps.

adding a new row to a table when adding another row in a different sheet

I have an Excel workbook in which I have several tables. On 3 of my sheets, there is some kind of "main" table which differ a bit from one another.
These tables are 2 lines by default (1 header and 1 data row) and extend when I add a new line below the one already existing. In some of the fields are formulas which are using values from the other tables. However, if for example, I insert a new value in a field below the final row, thus adding another row to the table, I want the tables in the other sheets to also add another row (and execute the formulas that are in the new row)
This is the sheet in which I have "Soorten Vezels" with their corresponding "max demping" and "soorten connectoren" with their corresponding "max demping":
This is the "maximale demping" file:
This is the measurement form, in this form, the user should not have to enter anything, except for the 2 dropdown menu's "type kabel" and "type connector":
What I would like is that when the user for example, inputs the length ("lengte") in the "maximale demping" file, a new row gets added (the fields "kabelnr", "van" and "naar" will be filled in automatically from the "gegevens" file)
But I would also like the workbook to add a new line in the measurement form, automatically fills in the "kabelnr", "van" and "naar" fields. So that I only have to choose the "type kabel" and "type connector" from the dropdown menu.
How do I do this (with VBA)?
Personally I like the MSDN when I am looking for answers to VBA and vb.net. I have found it to be thorough and comprehensive. The more I learn, the more I understand what they are teaching on this site.
This is a good tutorial to get started. Follow the links from this page.
Getting Started with VBA in Excel 2010
http://msdn.microsoft.com/en-us/library/office/ee814737(v=office.14).aspx
Also remember to search Stack Overflow as you progress, there are an amazing number of questions covering specifics you may require when you start, or ask more questions.
If you require further assistance you can look at the links below.
This link is helpful. But I would navigate through the links below to get a broader view and to find an explanation that works for you.
Insert Row in Tables Multiple Sheets Excel 2010
http://chandoo.org/forums/topic/insert-row-in-tables-multiple-sheets-excel-2010
A forum- this link leads to a question about inserting rows.
MrExcel.com
http://www.mrexcel.com/forum/excel-questions/58685-insert-rows-between-different-data-2-a.html
If you persevere, down the page, there is good discussion, with code examples and trouble shooting (you will get a pop up when you go to this link asking to sign up for the newsletter, you can disregard this without a problem)
Insert Row in Tables Multiple Sheets Excel 2010
http://chandoo.org/forums/topic/insert-row-in-tables-multiple-sheets-excel-2010
A useful Q&A from Microsoft forum.
Insert blank rows in excel table with vba
http://answers.microsoft.com/en-us/office/forum/office_2007-customize/insert-blank-rows-in-excel-table-with-vba/69e369a8-e656-4f68-adcd-c57e37253f12
Please let me know if this helps and ask new questions freely as you go.

generate a chart/graph in application using vb.net using excel worksheet data

How to generate a chart/graph in an application using vb.net using excel worksheet data?
I have a listview function that is already linking up the excel data and now wish to select certain data and create a line graph showing the results.
In listview I have each of the headings linked as a string.
Can a connection be made with either the ListViewItem or with the original Excel Worksheet. I want the graph to show on the general application form that has been created and not in an active Excel sheet.
Any help would be appreciated! :)
You should be ale to just databind whatever data you want in the listview with the chart. Can you give more details on how you want to select the data?
This shows Databinding (just pass in two arrays): http://msdn.microsoft.com/en-us/library/dd455475(v=vs.110).aspx
You could have two comboBoxes with the name of the potential x-values and the name of the potential y-values, and update the chart whenever one of the selected items changes.

Populate table in Word Template with VBA?

I'm filling in a Word template with data that's been collected from user input. In particular a (variable) number of documents is chosen, and information about each document fills a row of a table.
I've bookmarked several items in the template and successfully filled information in the header from my macro, but the table I'm not so sure with. I bookmarked the first cell and tried tabbing (with Chr(9)) through, and also tried passing an array. (In the template the table has only a first row. Usually tabbing past the last column creates an additional row.)
I can retieve cell contents with
Word.Application.ActiveDocument.Tables(1).Cell(3, 1).Range.Text
but can't write to the any cell except the first, where I placed a bookmark.
Can anyone offer a possible solution to populate the table?
To populate table, use this code
ActiveDocument.Tables(1).Cell(1, 1).Range.Text = "Blah Blah"
This will write to the first cell in the first table. Use a loop to fill the rest of the cells.
I would also recommend see this link.
Topic: Automating Word Tables for Data Insertion and Extraction
Link: http://msdn.microsoft.com/en-us/library/aa537149%28v=office.11%29.aspx#Y1254
Extract:
Summary: Learn how to automate the creation and formatting of tables in Word. Get information about optimizing performance, populating a table with data, formatting table structure, linking table data, and extracting data from a table. (25 printed pages)
I've actually ran into a similar problem using Access to automate filling out a Word table template. I found that if I opened the template in Word prior to running the VBA script, then the Word document is successfully filled out with the table information. My code looks similar to yours as far as adding to it by row. Because the number of fields to be transferred to the form is dynamic it didn't seem like bookmarks for each section would work. If you have any update, I'd be happy to hear of a different way to resolve this.