ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   AddIn (https://www.excelbanter.com/excel-programming/276825-addin.html)

Robin Clay[_2_]

AddIn
 
Greetings !

A continuation of a saga that started on 1st September,
and has elicited responses from several people, for whose
contribution I am very grateful. Alas ! The problem
remains...


I had a worksheet with some modules of code that I wanted
to use in other spreadsheets, as a "library" of functions.

It was suggested that I "save it as a .xla file", so when
I did "Save As..." I changed the extension to .xla, thus
producing a "pseudo AddIn", which, although it has worked
for the past nine months or so, still generates problems.
I have therefore tried to separate the "worksheet" part
from the "AddIn" part, saved by selecting the "AddIn"
option in the "Save As..." svreen - but the combination
now will not run.

I posted on 1st Sept, but that post and its replies are
now "lost in the mists of history", so I thought I would
try again, having followed advice. This is a "follow up".

Tom Ogilvy responded, 9/2/2003 11:10:39 AM

Rob Bovey's URL:


So I have now managed to run that. Alas ! It makes no
difference to the problem in hand, my code still refuses
to run.

I would also make my addin a workbook,


Please tell me how I do that?
There is no option to "Save As..." in VBE.

This seems to be going backwards ! My whole aim is to
convert a workbook to an AddIn + workbook.

then make it the active project (in
the vbe) and then go to tools=References
(in the vbe) and make sure nothing
is shown as missing.


At the moment, the code (that all used to run OK, when it
was in a psuedo .xla) now does not recognise the Common
Variables that I have declared in the new "genuine" .xla,
using these lines, and a lot more similar -

Public I0(20) As Double
Public Direction(3) As String
Public G1(32) As String * 8
Public Stxt$(10)
Public Ttxt$(5)

When it runs, it comes to a halt, believing that
Ttxt$(3)
is a Function Call

Taking the original "psuedo" .xla, I tried to separate
the "Worksheet" part from the "true" .xla part, but this
has meant that I have duplicated some of the code, in
the "ThisWorkbook" module, specifically, the
Workbook_BeforeClose procedure. I can't see that this
should have the effect at start up that I am
experiencing?

I have tried putting the Common Variables module in the
workbook, but made no difference.

Dave Ramage[_2_]

AddIn
 
Robin,

I'm not familiar with the previous thread, but an Addin is
basically just a workbook that is openned in the
background and kept hidden. The best way to create an
addin from a workbook and visa-versa is to change the
IsAddIn property of the workbook (Excel 97+). Do this from
the properties list in the VBE.

To get around your problem, I'd create a new workbook,
copy all the required code and worksheets into it and see
if it works.

Cheers,
Dave.

-----Original Message-----
Greetings !

A continuation of a saga that started on 1st September,
and has elicited responses from several people, for whose
contribution I am very grateful. Alas ! The problem
remains...


I had a worksheet with some modules of code that I wanted
to use in other spreadsheets, as a "library" of functions.

It was suggested that I "save it as a .xla file", so when
I did "Save As..." I changed the extension to .xla, thus
producing a "pseudo AddIn", which, although it has worked
for the past nine months or so, still generates

problems.
I have therefore tried to separate the "worksheet" part
from the "AddIn" part, saved by selecting the "AddIn"
option in the "Save As..." svreen - but the combination
now will not run.

I posted on 1st Sept, but that post and its replies are
now "lost in the mists of history", so I thought I would
try again, having followed advice. This is a "follow up".

Tom Ogilvy responded, 9/2/2003 11:10:39 AM

Rob Bovey's URL:


So I have now managed to run that. Alas ! It makes no
difference to the problem in hand, my code still refuses
to run.

I would also make my addin a workbook,


Please tell me how I do that?
There is no option to "Save As..." in VBE.

This seems to be going backwards ! My whole aim is to
convert a workbook to an AddIn + workbook.

then make it the active project (in
the vbe) and then go to tools=References
(in the vbe) and make sure nothing
is shown as missing.


At the moment, the code (that all used to run OK, when it
was in a psuedo .xla) now does not recognise the Common
Variables that I have declared in the new "genuine" .xla,
using these lines, and a lot more similar -

Public I0(20) As Double
Public Direction(3) As String
Public G1(32) As String * 8
Public Stxt$(10)
Public Ttxt$(5)

When it runs, it comes to a halt, believing that
Ttxt$(3)
is a Function Call

Taking the original "psuedo" .xla, I tried to separate
the "Worksheet" part from the "true" .xla part, but this
has meant that I have duplicated some of the code, in
the "ThisWorkbook" module, specifically, the
Workbook_BeforeClose procedure. I can't see that this
should have the effect at start up that I am
experiencing?

I have tried putting the Common Variables module in the
workbook, but made no difference.
.


Robin Clay[_2_]

AddIn
 

Dave Ramage was so kind as to respond (for which, many
thanks) :-

To get around your problem, I'd create a new workbook,
copy all the required code and worksheets into it and
see if it works.


...which is wot I dun... and it doesn't !

The nub is -

At the moment, the code (that all used to run OK, when
it was in a psuedo .xla) now does not recognise the
Common Variables that I have declared in the
new "genuine" .xla,
using these lines, and a lot more similar -

Public I0(20) As Double
Public Direction(3) As String
Public G1(32) As String * 8
Public Stxt$(10)
Public Ttxt$(5)

When it runs, it comes to a halt, believing that
Ttxt$(3)
is a Function Call


I have tried putting the Common Variables module
in the workbook, but it made no difference.




All times are GMT +1. The time now is 11:24 AM.

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