danial
Board Regular
- Joined
- Apr 29, 2006
- Messages
- 107
I want to create vba code to reference cell "A1" in the excel add-in.
I know I can type the direct reference. Workbooks("MyAddIn.xls").Sheets("Sheet1").Range("A1")
but when I changed the name of add-in file. that code is not work.
I don't want to change the code as the name of file
I try to put this code in Open Workbook
================================
Public Wk as Workbook
Sub Aut
pen()
Set Wk = Application.ActiveWorkbook
End Sub
Sub GetA1()
Msgbox Wk.Sheets("Sheet1").Range("A1")
End Sub
================================
This code can run on normal excel but when I save as the excel add-in
After that I try to run GetA1. It dose not work.
Does anyone please correct me
I know I can type the direct reference. Workbooks("MyAddIn.xls").Sheets("Sheet1").Range("A1")
but when I changed the name of add-in file. that code is not work.
I don't want to change the code as the name of file
I try to put this code in Open Workbook
================================
Public Wk as Workbook
Sub Aut
Set Wk = Application.ActiveWorkbook
End Sub
Sub GetA1()
Msgbox Wk.Sheets("Sheet1").Range("A1")
End Sub
================================
This code can run on normal excel but when I save as the excel add-in
After that I try to run GetA1. It dose not work.
Does anyone please correct me