ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   how can we embed the code to the excel workbook from addin (https://www.excelbanter.com/excel-programming/439094-how-can-we-embed-code-excel-workbook-addin.html)

vicky

how can we embed the code to the excel workbook from addin
 
i have created a addin through which i can set the password and does
couple of other things as well . my need is i need to embed that code
on the report on which i use this addin . say there is a report
callled test.xls when i use my addin on this report and send it
accross the client i need my code to get copied in the report
test.xls .... since i am using this addin on couple of reports i
cannot manually copy paste the code ...

joel[_625_]

how can we embed the code to the excel workbook from addin
 

The easiest method is to create a template workbook with the macro in
the template. Then make a copy of the template when you start your
macro.

If code is located on the VBA sheet (not module) if you copy the sheet
the code also gets copies. In VBa if you copy a sheet and do not use
Affter or Before it automatically creates a new workbook with only one
sheet.

Another method is to write a macro that saves the VBA code to a BAS
file and then read the BAS file into the 2nd workbook. Chip Pearson has
good instruction on doing this at his website

'Programming In The VBA Editor'
(http://www.cpearson.com/excel/vbe.aspx)

Read the two bullets at the top of the webpage espcially the one
below.

•Next, you need to enable programmatic access to the VBA Project. In
Excel 2003 and earlier, go the Tools menu (in Excel, not in the VBA
editor), choose Macros and then the Security item. In that dialog, click
on the Trusted Publishers tab and check the Trust access to the Visual
Basic Project setting.


--
joel
------------------------------------------------------------------------
joel's Profile: 229
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=175507

Microsoft Office Help


Phil Hibbs

how can we embed the code to the excel workbook from addin
 
joel wrote:
Another method is to write a macro that saves the VBA code to a BAS
file and then read the BAS file into the 2nd workbook. Chip Pearson has
good instruction on doing this at his website

'Programming In The VBA Editor'
(http://www.cpearson.com/excel/vbe.aspx)


Best web page ever! Thanks.

Phil Hibbs.

joel[_628_]

how can we embed the code to the excel workbook from addin
 

Phil: Did you see the rest of Chip's website


'CPearson.com Topic Index' (http://www.cpearson.com/excel/topic.aspx)


--
joel
------------------------------------------------------------------------
joel's Profile: 229
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=175507

Microsoft Office Help


Chip Pearson

how can we embed the code to the excel workbook from addin
 

Thanks.

Cordially,
Chip Pearson
Microsoft MVP 1998 - 2010
Pearson Software Consulting, LLC
www.cpearson.com
[email on web site]


On Tue, 2 Feb 2010 06:46:06 -0800 (PST), Phil Hibbs
wrote:

joel wrote:
Another method is to write a macro that saves the VBA code to a BAS
file and then read the BAS file into the 2nd workbook. Chip Pearson has
good instruction on doing this at his website

'Programming In The VBA Editor'
(http://www.cpearson.com/excel/vbe.aspx)


Best web page ever! Thanks.

Phil Hibbs.


Phil Hibbs

how can we embed the code to the excel workbook from addin
 
joel wrote:
Phil: Did you see the rest of Chip's website
'CPearson.com Topic Index' (http://www.cpearson.com/excel/topic.aspx)


OK, that's this lifetime filled up with things to read.

Phil.


All times are GMT +1. The time now is 01:16 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com