Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel macro question

Status
Not open for further replies.

121854

MIS
Aug 2, 2003
60
US
I have a template excel spreadsheet that would like to use it as a template to download a file from the internet.

The macros in the template works correctly but when I download the file from the net and replace the template all the macros (module 1 for ThisWorkbook and the Personal macros xls) are gone.

Is there anyway to replace the templace and keep the original vba modules? Or better say is there a way that I can just replace the contents of the cells in the template when I replace the template.

Please advise. [sadeyes]


 
Make the macros an add-in, then you can run them from any worksheet. From
Start the Visual Basic Editor by pressing Alt+F11.
Select Debug, Compile VBA projectname. In previous versions of Excel the VBA-code was automatically
compiled when you saved the addin. This is no longer true, you have to do it yourself before you save the addin.
If you want to lock the project from viewing you can select Tools, Properties for VBA projectname.
In this dialog you activate Protection and check the option Lock project for viewing.
Fill in a password and click the OK-button.
Activate Excel by pressing Alt+F11.
Select File, Properties..., Summary and fill inn information for the fields Title and Comments.
The title will be the name that appears in the Add-Ins dialog (the dialog displaying available add-ins),
the comment will be the description that appears when you select the addin in the Add-Ins dialog.
Click the OK-button to close the Properties dialog.
Select File, Save as….
Change the option Filetype: to Microsoft Excel addin (*.xla) (the last choice in the dropdown).
The add-in must contain at least one worksheet if this option is to be displayed.
Click the Save-button to save the workbook as an addin.
The locking of the project will not take effect until you close and re-open the workbook.

You can convert a workbook to an addin by changing the property IsAddin to True for the ThisWorkbook-object.
This must be done from the Visual Basic Editor. When the property is changed you can save the workbook by
clicking on the Save-toolbarbutt
 

121845,

Where is your CODE?????????

Skip,
[sub]
[glasses] [red]Be Advised![/red] For those this winter, caught in Arctic-like calamity, be consoled...
Many are cold, but few are frozen![tongue][/sub]
 
AlexIT - Thank you for the article and message. However, can you provide me the code to set the property IsAddin to True. Or an example, on how to set thisworkbook object addin to true.

I have not being able to figure it out.

Thank you again.
 
Open VB Editor, left click once on "ThisWorkbook" in top left frame, in bottom left frame choose alphabetic tab, 13 lines from top is the IsAddin property.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top