Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Making VBA code from one WB work on another WB

I'm working on basically a complex order taking/proposal/scope of work
spreadsheet and am doing pretty well with the coding for tricks I need.
However, I'm starting to generate a rather large file due to all the
background code. In order to keep the file size down, I want to offload a
lot of the commonly-used VBA code onto another spreadsheet (JOBLOG.xls) that
is always kept running, and call the code from there.

The problem I'm having is how to get the subroutines to look back and work
on the spreadsheet that's calling them. The names change dynamically, so
this is part of the problem.

For example, the spreadsheet starts off as NEWORDER.xls. One of the subs
I'd like to have in JOBLOG.xls is subSaveFileAs. This will basically look at
some cells on NEWORDER.xls to name the file in a very specific format,
concatenate the filename from that, then rename NEWORDER.xls to (for this
example) CUSTORDER1.xls.

How do I get subSaveFileAs to look into NEWORDER.xls, then adapt to it when
it re-names it CUSTORDER1.xls, plus also be able to re-run the sub (say, to
create a second version of the file as CUSTORDER1a.xls) and have it look at
whichever worksheet called it?

I assume that there's some simple identifier that I could append to each
range reference (like "CallingWorkbook." to "shtCode.Range("B1")) to make
this work easily, but I don't know what it is and haven't been able to locate
it in my reference books. Apparently I don't speak 'crossreferencese' very
well.

Thanks in advance for any help.

- Forest Ramsey
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Making VBA code from one WB work on another WB

Hi ForestRamsey,

Try ActiveWorkbook.


---
Regards,
Norman



"ForestRamsey" wrote in message
...
I'm working on basically a complex order taking/proposal/scope of work
spreadsheet and am doing pretty well with the coding for tricks I need.
However, I'm starting to generate a rather large file due to all the
background code. In order to keep the file size down, I want to offload a
lot of the commonly-used VBA code onto another spreadsheet (JOBLOG.xls)
that
is always kept running, and call the code from there.

The problem I'm having is how to get the subroutines to look back and work
on the spreadsheet that's calling them. The names change dynamically, so
this is part of the problem.

For example, the spreadsheet starts off as NEWORDER.xls. One of the subs
I'd like to have in JOBLOG.xls is subSaveFileAs. This will basically look
at
some cells on NEWORDER.xls to name the file in a very specific format,
concatenate the filename from that, then rename NEWORDER.xls to (for this
example) CUSTORDER1.xls.

How do I get subSaveFileAs to look into NEWORDER.xls, then adapt to it
when
it re-names it CUSTORDER1.xls, plus also be able to re-run the sub (say,
to
create a second version of the file as CUSTORDER1a.xls) and have it look
at
whichever worksheet called it?

I assume that there's some simple identifier that I could append to each
range reference (like "CallingWorkbook." to "shtCode.Range("B1")) to make
this work easily, but I don't know what it is and haven't been able to
locate
it in my reference books. Apparently I don't speak 'crossreferencese'
very
well.

Thanks in advance for any help.

- Forest Ramsey



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Making VBA code from one WB work on another WB

DOH! I knew it would be something simple. Thanks. Much appreciated.

"Norman Jones" wrote:

Hi ForestRamsey,

Try ActiveWorkbook.


---
Regards,
Norman



"ForestRamsey" wrote in message
...
I'm working on basically a complex order taking/proposal/scope of work
spreadsheet and am doing pretty well with the coding for tricks I need.
However, I'm starting to generate a rather large file due to all the
background code. In order to keep the file size down, I want to offload a
lot of the commonly-used VBA code onto another spreadsheet (JOBLOG.xls)
that
is always kept running, and call the code from there.

The problem I'm having is how to get the subroutines to look back and work
on the spreadsheet that's calling them. The names change dynamically, so
this is part of the problem.

For example, the spreadsheet starts off as NEWORDER.xls. One of the subs
I'd like to have in JOBLOG.xls is subSaveFileAs. This will basically look
at
some cells on NEWORDER.xls to name the file in a very specific format,
concatenate the filename from that, then rename NEWORDER.xls to (for this
example) CUSTORDER1.xls.

How do I get subSaveFileAs to look into NEWORDER.xls, then adapt to it
when
it re-names it CUSTORDER1.xls, plus also be able to re-run the sub (say,
to
create a second version of the file as CUSTORDER1a.xls) and have it look
at
whichever worksheet called it?

I assume that there's some simple identifier that I could append to each
range reference (like "CallingWorkbook." to "shtCode.Range("B1")) to make
this work easily, but I don't know what it is and haven't been able to
locate
it in my reference books. Apparently I don't speak 'crossreferencese'
very
well.

Thanks in advance for any help.

- Forest Ramsey




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Making changes in all pages in a work book AJ_Knight Excel Discussion (Misc queries) 2 February 24th 06 08:23 AM
Making this formula work Kleev Excel Worksheet Functions 5 December 15th 05 12:42 AM
Making a Reuters function work in VBA gearoi Excel Discussion (Misc queries) 2 October 19th 05 04:48 PM
making a userform work ,oops scott t Excel Programming 2 April 26th 04 12:51 AM
making a userform work scott t Excel Programming 0 April 25th 04 11:11 PM


All times are GMT +1. The time now is 03:24 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"