`As part of a project across a local network I had a file (file A) that sends data to the Masterfile (file B). As it was on a local network data was lost when both files where open and changes where made. To correct this issue I made another excel file where when file A is opened it sends “Locked” to cell A1 in the new excel file and when file A is closed it sends “Unlocked” to cell A1, and visa versa for file B. This part works as intended but the issue arises when I attempt to send data from file A to file B.
What i attempted to do is create a go between file. File A sends the data to file C witch in turn sends the data to file B after file A closes.
This sub is seen in File A in a module
Public Sub OpenSecondWorkbookAndScheduleMacro()
Dim secondWbk As Workbook
Dim secondWbkPath As String
secondWbkPath = "\shannonPublicDemoLogMBLink.xlsm" ' Path to the second workbook
' Open the second workbook
Set secondWbk = Workbooks.Open(secondWbkPath)
' Schedule the macro in the second workbook to run after a short delay
Application.OnTime Now + TimeValue("00:00:05"), "'" & secondWbk.Name & "'!SendToMB"
This sub is seen in file B on a sheet
Sub SendToMB()
' Turn off screen updating to improve performance and avoid screen flickering
Application.ScreenUpdating = False
' Call the subroutines
SaveDataMasterWorkBook
MoveDATA
Dim wbMaster As Workbook
Dim wbLocal As Workbook
' Set the master workbook object, assuming it's already opened by the subs called
Set wbMaster = Workbooks("Maintance Board Issue Log2.xlsm")
' Set the current workbook as wbLocal
Set wbLocal = ThisWorkbook
' Clear specific cells in the "Technicians" sheet of the local workbook
wbLocal.Worksheets("Technicians").Range("C6").Value = ""
wbLocal.Worksheets("Technicians").Range("D6").Value = ""
wbLocal.Worksheets("Technicians").Range("E6").Value = ""
wbLocal.Worksheets("Technicians").Range("G6").Value = ""
wbLocal.Worksheets("Technicians").Range("H6").Value = ""
wbLocal.Worksheets("Technicians").Range("I6").Value = ""
' Turn screen updating back on
Application.ScreenUpdating = True
ActiveWorkbook.Close SaveChanges:=True
Application.DisplayAlerts = True
' Close the master workbook, saving any changes
wbMaster.Close True
End Sub
End Sub
As well as any possible suggestions to my problem I would love to know if what i am currently attempting is theoretically possible.
ROL15W is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.