0

I'm currently updating a Worksheet in the ActiveWorkbook on the fly from a network file.

I'd like to move this Ws from the ActiveWorkbook into an XLA Add-In.

If I do so, will I still be able to update it (ie update the data then save the XLA Add-In) if the XLA Add-In is password-protected ? Would something like this work ?

Private Sub updateMyXLASheet(ByVal MyDataArray as Variant)

ThisWorkbook.Sheet("myXLADataSheet").Range("myDataArrayGoesHere").Value = MyDataArray
Application.DislayAlertes = False
ThisWorkbook.Save
Application.DislayAlertes = True

End Sub

(ThisWorkbook being the XLA Add-In workbook)

Community
  • 1
  • 1
Tibo
  • 383
  • 5
  • 27
  • Pretty easy to test - did you try it? – Tim Williams Aug 03 '17 at 21:55
  • @TimWilliams. Thats what I just did succefully :-D. PS : My macro being rather big/complex, I just spend several hours replacing hundreds of `ThisWorkbook` references with the correct `ActiveWorkbook` / `ThisWorkbook` / `myDataWorkbook` ones. (And since it was the first time a was dealing with a complex `XLA Add-In`, it was actually not that easy.) However, I just found Excel will not let me define `Names` in the `ActiveWorkbook` refering to `ThisWorkbook`... – Tibo Aug 03 '17 at 22:28
  • What happens when you try to add a name? I just ran this from an add-in with no problem: `ActiveWorkbook.Names.Add "Test", ThisWorkbook.Sheets(1).Range("A1")` – Tim Williams Aug 03 '17 at 22:40
  • Actually, I'm able to successfully create `Names` referering to the `XLA Add-In`, but if I save and close the `ActiveWorkbook`, links updating will fail when I open it again... EDIT : It seems like I'm wrong and that the `Names` is indeed working fine... – Tibo Aug 03 '17 at 23:22

1 Answers1

0

It seems like Excel have no problem updating then saving a Sheet on a password protected XLA Add-In.

Tibo
  • 383
  • 5
  • 27