Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 279
Default Organising large amounts of VBA code

I use Excel 2003 from Vista
As a naive Excel VBA user, I wrote code to Application.StartupPath &
"\personal.xls"

That file consists of 2 modules.

The first is nearly 4k lines of my own code.

The second is Chip Pearson's modRegistry code.
(I use CreateObject("InternetExplorer.Application") to access http URLs
and found IE can be painfully slow if images are downloaded.
RegistryCreateValue HKCU, "Software\Microsoft\Internet Explorer\Main", _
"Display Inline Images", "no"
switches off image downloading.
RegistryCreateValue HKCU, "Software\Microsoft\Internet Explorer\Main", _
"Expand Alt Text", "yes"
puts placeholders in place for images.)

I now want to write code in a second file (foo.xls), sharing
personal.xls code. How do I make personal.xls code usable from foo.xls?
Thanks!
--
Walter Briscoe
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 834
Default Organising large amounts of VBA code

Run the procedures using Application.Run

Application.Run "Personal.xls!myMacro"

--

HTH

Bob

"Walter Briscoe" wrote in message
...
I use Excel 2003 from Vista
As a naive Excel VBA user, I wrote code to Application.StartupPath &
"\personal.xls"

That file consists of 2 modules.

The first is nearly 4k lines of my own code.

The second is Chip Pearson's modRegistry code.
(I use CreateObject("InternetExplorer.Application") to access http URLs
and found IE can be painfully slow if images are downloaded.
RegistryCreateValue HKCU, "Software\Microsoft\Internet Explorer\Main", _
"Display Inline Images", "no"
switches off image downloading.
RegistryCreateValue HKCU, "Software\Microsoft\Internet Explorer\Main", _
"Expand Alt Text", "yes"
puts placeholders in place for images.)

I now want to write code in a second file (foo.xls), sharing
personal.xls code. How do I make personal.xls code usable from foo.xls?
Thanks!
--
Walter Briscoe



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 279
Default Organising large amounts of VBA code

In message of Mon, 22 Mar 2010
09:52:55 in microsoft.public.excel.programming, Bob Phillips
writes
Run the procedures using Application.Run

Application.Run "Personal.xls!myMacro"


Thanks! I did that. An example is:

In personal.xls:

....
Dim IE As Object ' IWebBrowser2 ' SHDocVw.InternetExplorer
....

Private Sub TxURL(ByVal URL1 As String)
If IE Is Nothing Then
Set IE = CreateObject("InternetExplorer.Application")
....

In Oyster.xls:
Application.Run "personal.xls!TxURL", _
"https://oyster.tfl.gov.uk/oyster/entry.do"

I am pleasantly surprised to see that the Private procedure TxURL is
visible on the interface between the files. I did not want to make such
interfaces visible in the list accessed by Tools/Macro/Macros... aka
Alt+F8.

Shared data interfaces in personal.xls - such as IE above - are
invisible from Oyster.xls.
How do I make such interfaces visible?
If nothing better offers, I can probably use optional procedure
interfaces, so that internal calls can use shared data and external
calls use parameter interfaces. This would minimise the need to change
personal.xls.
--
Walter Briscoe
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 834
Default Organising large amounts of VBA code

You can make TxURL public, it will not be visible to Tools/Macro/Macros...
because it has an argument.

--

HTH

Bob

"Walter Briscoe" wrote in message
...
In message of Mon, 22 Mar 2010
09:52:55 in microsoft.public.excel.programming, Bob Phillips
writes
Run the procedures using Application.Run

Application.Run "Personal.xls!myMacro"


Thanks! I did that. An example is:

In personal.xls:

...
Dim IE As Object ' IWebBrowser2 ' SHDocVw.InternetExplorer
...

Private Sub TxURL(ByVal URL1 As String)
If IE Is Nothing Then
Set IE = CreateObject("InternetExplorer.Application")
...

In Oyster.xls:
Application.Run "personal.xls!TxURL", _
"https://oyster.tfl.gov.uk/oyster/entry.do"

I am pleasantly surprised to see that the Private procedure TxURL is
visible on the interface between the files. I did not want to make such
interfaces visible in the list accessed by Tools/Macro/Macros... aka
Alt+F8.

Shared data interfaces in personal.xls - such as IE above - are
invisible from Oyster.xls.
How do I make such interfaces visible?
If nothing better offers, I can probably use optional procedure
interfaces, so that internal calls can use shared data and external
calls use parameter interfaces. This would minimise the need to change
personal.xls.
--
Walter Briscoe



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
Graphing Large Amounts of Data BSc Chem Eng Rick Charts and Charting in Excel 1 July 1st 09 08:41 PM
Graphing Large Amounts of Data BSc Chem Eng Rick Excel Discussion (Misc queries) 1 June 29th 09 01:19 PM
Managing Large Amounts of Data OpAmp Excel Discussion (Misc queries) 1 November 11th 08 09:36 PM
Doing Analysis from large amounts of DATA william4444 New Users to Excel 3 May 15th 06 09:01 AM
pasting large amounts of text jeff Excel Discussion (Misc queries) 2 January 27th 06 08:32 PM


All times are GMT +1. The time now is 12:38 PM.

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

About Us

"It's about Microsoft Excel"