Why is Referenced Workbook Saved When ActiveWorkbook is Saved?

R

RyanH

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
 
D

dbKemp

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

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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top