Tanyaann1995
Board Regular
- Joined
- Mar 24, 2021
- Messages
- 62
- Office Version
- 2016
- Platform
- Windows
Hi,
I want to link an Excel workbook to a file in Teams and update some information in the Teams file from the workbook in desktop. I want to add some information in a Teams file from an Excel workbook in the desktop by linking those two.
This is the code i created:
When the teams file is updated with all the information, it has to close and save. The problem here is the above pop up comes up asking to save as another copy instead of updating in the same file. I dont want to create a copy, i just want the code to update in the same file in Teams but instead it creates a copy. Is there any way to fix this?
I want to link an Excel workbook to a file in Teams and update some information in the Teams file from the workbook in desktop. I want to add some information in a Teams file from an Excel workbook in the desktop by linking those two.
This is the code i created:
VBA Code:
Dim xx As Object
Set wb = ActiveWorkbook
sFileName = "https://emerson.sharepoint.com/sites/PRVOrders/Shared%20Documents/General/TAT.xlsx"
Set xx = CreateObject("Excel.Application")
Set f = xx.Application.Workbooks.Open(Filename:=sFileName, ReadOnly:=False)
lastrow = f.Worksheets(1).Cells(Rows.Count, "A").End(xlUp).Row + 1
f.Worksheets(1).Cells(lastrow, "A").Value = wb.Worksheets("Order Entry Form").Range("F13").Value
f.Worksheets(1).Cells(lastrow, "B").Value = wb.Worksheets("Order Entry Form").Range("D13").Value
f.Worksheets(1).Cells(lastrow, "C").Value = wb.Worksheets("Order Entry Form").Range("D21").Value
f.Worksheets(1).Cells(lastrow, "D").Value = wb.Worksheets("Order Entry Form").Range("D9").Value
f.Worksheets(1).Cells(lastrow, "E").Value = Date
f.Worksheets(1).Cells(lastrow, "F").Value = wb.Worksheets("Order Entry Form").Range("D15").Value
f.Worksheets(1).Cells(lastrow, "G").Value = wb.Worksheets("Order Entry Form").Range("D7").Value
f.Worksheets(1).Cells(lastrow, "H").Value = wb.Worksheets("Order Entry Form").Range("F19").Value
f.Worksheets(1).Cells(lastrow, "I").Value = wb.Worksheets("Order Entry Form").Range("F9").Value
f.Worksheets(1).Cells(lastrow, "L").Value = wb.Worksheets("Checklist").Range("B20").Value
f.Worksheets(1).Cells(lastrow, "M").Value = wb.Worksheets("Order Entry Form").Range("O9").Value
f.Worksheets(1).Cells(lastrow, "N").Value = wb.Worksheets("ENQUIRY - ORDER REVIEW").Range("F27").Value
f.Worksheets(1).Cells(lastrow, "O").Value = "PRV"
f.Close savechanges:=True
Set f = Nothing
When the teams file is updated with all the information, it has to close and save. The problem here is the above pop up comes up asking to save as another copy instead of updating in the same file. I dont want to create a copy, i just want the code to update in the same file in Teams but instead it creates a copy. Is there any way to fix this?