![]() |
Saving Data
I have a couple of userforms/workbooks that I need to save to a closed
workbook... How can this be accomplished... I have searched but to no avail.... PLZ HELP... |
Saving Data
What does saving userforms/workbooks to another workbook even mean, much less
a closed workbook? You can export a useform, open another workbook and import it. You can copy worksheets from one open workbook to another. This can be done in code. Sure it wouldn't just be easier to have your code open the workbook and make the additions, then save it and close it. -- Regards, Tom Ogilvy "DarnTootn" wrote: I have a couple of userforms/workbooks that I need to save to a closed workbook... How can this be accomplished... I have searched but to no avail.... PLZ HELP... |
Saving Data
sorry, my explanation was not that good.. here is the situation... When an
employee inputs data in a userform the data is saved to two different worksheets within the the workbook. everything works perfectly. Now the boss wants the second worksheet information saved not into the same workbook but into a closed workbook. is there a code to save this information to the closed workbook called "ProjectStats".. currently that sheet is in the workbook with the userform that is open. the ProjectStats workbook is not open and only accessible to myself and a handful of admin folks... we do not want the reg. employees to have to open the second workbook to save that information to this second workbook.... Does that explain it a little better... here is an example of the code I am currently using to send the information to the proper worksheet within the open workbook.. Private Sub cmdAdd_Click() Dim iRow As Long Dim ws As Worksheet Dim ws1 As Worksheet Set ws1 = Worksheets("ProjectData") Set ws = Worksheets("Billing Sheet") 'find first empty row in database iRow = ws1.Cells(Rows.Count, 1) _ .End(xlUp).Offset(1, 0).Row 'copy data to database With ws1 .Cells(iRow, 1).Value = Me.txtProjectName.Value .Cells(iRow, 2).Value = Me.txtStartDate.Value .Cells(iRow, 3).Value = Me.txtEndDate.Value.....(a total of 16 lines of code here continues... then.... 'copy data to database With ws .Cells(12, 1).Value = Me.txtCoopName.Value .Cells(12, 4).Value = Me.txtProjectName.Value .Cells(12, 7).Value = Me.cboCrewName.Value...(more cells after this too) So you can see I have two worksheets within the workbook ws and ws1. ws1 is the info I need to go to the closed workbook.. thanks for your help... you have helped me in the past... your info is great "Tom Ogilvy" wrote: What does saving userforms/workbooks to another workbook even mean, much less a closed workbook? You can export a useform, open another workbook and import it. You can copy worksheets from one open workbook to another. This can be done in code. Sure it wouldn't just be easier to have your code open the workbook and make the additions, then save it and close it. -- Regards, Tom Ogilvy "DarnTootn" wrote: I have a couple of userforms/workbooks that I need to save to a closed workbook... How can this be accomplished... I have searched but to no avail.... PLZ HELP... |
Saving Data
Then you would need to treat the closed workbook as a database and update it
using ADO Mr. Erlandson has some information on ADO and excel although I believe it is more focused on reading than writing: DAO/ADO http://www.erlandsendata.no/english/...php?t=envbadac -- Regards, Tom Ogilvy "DarnTootn" wrote: sorry, my explanation was not that good.. here is the situation... When an employee inputs data in a userform the data is saved to two different worksheets within the the workbook. everything works perfectly. Now the boss wants the second worksheet information saved not into the same workbook but into a closed workbook. is there a code to save this information to the closed workbook called "ProjectStats".. currently that sheet is in the workbook with the userform that is open. the ProjectStats workbook is not open and only accessible to myself and a handful of admin folks... we do not want the reg. employees to have to open the second workbook to save that information to this second workbook.... Does that explain it a little better... here is an example of the code I am currently using to send the information to the proper worksheet within the open workbook.. Private Sub cmdAdd_Click() Dim iRow As Long Dim ws As Worksheet Dim ws1 As Worksheet Set ws1 = Worksheets("ProjectData") Set ws = Worksheets("Billing Sheet") 'find first empty row in database iRow = ws1.Cells(Rows.Count, 1) _ .End(xlUp).Offset(1, 0).Row 'copy data to database With ws1 .Cells(iRow, 1).Value = Me.txtProjectName.Value .Cells(iRow, 2).Value = Me.txtStartDate.Value .Cells(iRow, 3).Value = Me.txtEndDate.Value.....(a total of 16 lines of code here continues... then.... 'copy data to database With ws .Cells(12, 1).Value = Me.txtCoopName.Value .Cells(12, 4).Value = Me.txtProjectName.Value .Cells(12, 7).Value = Me.cboCrewName.Value...(more cells after this too) So you can see I have two worksheets within the workbook ws and ws1. ws1 is the info I need to go to the closed workbook.. thanks for your help... you have helped me in the past... your info is great "Tom Ogilvy" wrote: What does saving userforms/workbooks to another workbook even mean, much less a closed workbook? You can export a useform, open another workbook and import it. You can copy worksheets from one open workbook to another. This can be done in code. Sure it wouldn't just be easier to have your code open the workbook and make the additions, then save it and close it. -- Regards, Tom Ogilvy "DarnTootn" wrote: I have a couple of userforms/workbooks that I need to save to a closed workbook... How can this be accomplished... I have searched but to no avail.... PLZ HELP... |
All times are GMT +1. The time now is 07:28 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com