Add Data into Worksheet of an AddIn

JonRowland

Active Member
Joined
May 9, 2003
Messages
417
Office Version
  1. 365
Platform
  1. Windows
Hi Guys,

I have an Add-In and various procedures look up various directories to pull data and other stuff.

Whilst this works fine, if I move my Add-In to another network with different Drive names then I have to go and amend the code to fit with the new Drive conventions. Fine if it is me but if I give it to let's say non-techs then I'd have to give then passwords to unlock the code and tell them what to change etc etc. Too much risk as they may screw the code up.

So I had a bright idea and why not allow User to run a procedure which present them with a Form to fill and then save that data into the Worksheet 1 of the Add-In and update my code to use the info stored in that WkSht.

So I have the form but can't work out how to write to the Add-In Worksheet.

So I thought I would be able to use this code within the Form but it fails on the ActiveWorkBook part.

Any help or suggestions would be most welcome.

Code:
Public gblSourceDrive as string
Public gblProcessFolder as string

Private Sub OKButton_Click()

' Set Variable Values from Form Data
gblSourceDrive = txtSourceDrive
gblProcessFolder = txtProcessFolder
 
' Transfer information into WkSht(1) of Add-In
ActiveWorkbook("MyAddIn.xlam").Sheets(1).Cells(2, 2) = gblSourceDrive
ActiveWorkbook("MyAddIn.xlam").Sheets(1).Cells(3, 2) = gblProcessFolder

' To add code to Save

End Sub
 
Last edited by a moderator:

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
Use ThisWorkbook, rather than ActiveWorkbook("MyAddIn.xlam").
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,182
Members
453,021
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top