ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Why is Referenced Workbook Saved When ActiveWorkbook is Saved? (https://www.excelbanter.com/excel-programming/419246-why-referenced-workbook-saved-when-activeworkbook-saved.html)

RyanH

Why is Referenced Workbook Saved When ActiveWorkbook is Saved?
 
I have a workbook saved as an Add-In that I use as a Reference for a Data
workbook. I have this code in the Data workbooks Before Save Event. For
some reason , when I save the Data workbook the Reference Add-In workbook is
saved also, why? I noticed the last modified date changes to the Data
workbooks last modified date. I do not want the Add-In saved when the Data
workbook is saved. Any ideas on fixing this?

' save a copy in public Power Vault folder
strBackUpPath = "\\Powervault\Global Schedule BU\"
ThisWorkbook.SaveCopyAs (strBackUpPath & ThisWorkbook.Name)

' ' get computer network user name
Set objNetwork = CreateObject("Wscript.network")
myUserName = objNetwork.UserName

' save a copy in Ryan's My Documents if ryanh is signed in
If myUserName = "ryanh" Then
strBackUpPath = "C:\Documents and Settings\ryanh\My Documents\Ryan's
BackUp Programs\Global Schedule BackUps\"
ThisWorkbook.SaveCopyAs (strBackUpPath & ThisWorkbook.Name)
End If
--
Cheers,
Ryan

dbKemp

Why is Referenced Workbook Saved When ActiveWorkbook is Saved?
 
On Oct 29, 3:36 pm, RyanH wrote:
I have a workbook saved as an Add-In that I use as a Reference for a Data
workbook. I have this code in the Data workbooks Before Save Event. For
some reason , when I save the Data workbook the Reference Add-In workbook is
saved also, why? I noticed the last modified date changes to the Data
workbooks last modified date. I do not want the Add-In saved when the Data
workbook is saved. Any ideas on fixing this?

' save a copy in public Power Vault folder
strBackUpPath = "\\Powervault\Global Schedule BU\"
ThisWorkbook.SaveCopyAs (strBackUpPath & ThisWorkbook.Name)

' ' get computer network user name
Set objNetwork = CreateObject("Wscript.network")
myUserName = objNetwork.UserName

' save a copy in Ryan's My Documents if ryanh is signed in
If myUserName = "ryanh" Then
strBackUpPath = "C:\Documents and Settings\ryanh\My Documents\Ryan's
BackUp Programs\Global Schedule BackUps\"
ThisWorkbook.SaveCopyAs (strBackUpPath & ThisWorkbook.Name)
End If
--
Cheers,
Ryan


Are you sure that the addin has been saved?
When an addin is open the Date Modified is when it was opened for use
(at least on my computer).

I don't see where you interacted with the addin. Do you change
anything in the addin when it is being accessed by your code?


All times are GMT +1. The time now is 11:24 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com