#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 36
Default Import macro

I have tried and tried to get a certain macro to work from the Personal
Macro Workbook (PMW). It generates errors. On a lark, I created a module in
the current open workbook and pasted the macro there, and deleted it from
the PMW. The macro runs perfectly there.

Is there a way that I can create a PMW macro that will check to see it such
a macro exists in the current workbook and if it doesn't, access a text file
that contains the mis-behaving macro and paste it into a module in the
current workbook instead?

Gene Augustin

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,203
Default Import macro

Achieving your goal is possible, not necessarily an easy path to follow, but
yes - VBA code can modify other VBA code in certain circumstances.

Perhaps the best starting point I can give you is a page on Chip Pearson's
web site that discusses this kind of thing. Then you can post back with
individual questions regarding where you may have stumped your toe while
trying to get this done.

Warning: some code changes via VBA code require manually lowering your
security shields, so to speak, and so you may not want to keep things going
in this fashion all the time.

I do have one tool that I use to upgrad normal code modules on customer's
systems that might be of use to you. In essence it does what you want it to
do - make sure that a particular code module exists in a particular file. It
actually doesn't ask "are you there already" - but rather it says, "I've got
what you need, now here, TAKE IT! and if you already had it, you've got it
again, only newer". Contact me at [remove spaces] HelpFrom @ j lathamsite
..com if you're interested. Just keep in mind, it's not for PMW, but is a
stand alone Excel application that requires a touch of setup for the security
settings and is run "on demand" by the user.

"Gene Augustin" wrote:

I have tried and tried to get a certain macro to work from the Personal
Macro Workbook (PMW). It generates errors. On a lark, I created a module in
the current open workbook and pasted the macro there, and deleted it from
the PMW. The macro runs perfectly there.

Is there a way that I can create a PMW macro that will check to see it such
a macro exists in the current workbook and if it doesn't, access a text file
that contains the mis-behaving macro and paste it into a module in the
current workbook instead?

Gene Augustin


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,203
Default Import macro

Of course, the real solution here would be to find out why the macro doesn't
work in the PMW but does in the target workbook.

I suspect it is using references to some long lost workbook, or worksheets
and ranges that don't exist. Was this macro possibly originally a recorded
macro rather than one written by a human hand?

"Gene Augustin" wrote:

I have tried and tried to get a certain macro to work from the Personal
Macro Workbook (PMW). It generates errors. On a lark, I created a module in
the current open workbook and pasted the macro there, and deleted it from
the PMW. The macro runs perfectly there.

Is there a way that I can create a PMW macro that will check to see it such
a macro exists in the current workbook and if it doesn't, access a text file
that contains the mis-behaving macro and paste it into a module in the
current workbook instead?

Gene Augustin


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
Excel Import Macro gkarasiewicz Excel Discussion (Misc queries) 5 January 12th 08 06:08 PM
Macro to Import Text Miasha Excel Discussion (Misc queries) 8 August 18th 06 04:30 PM
Import CSV files using Macro Mintz87 New Users to Excel 3 August 29th 05 09:48 PM
import data with macro chris_rip Excel Discussion (Misc queries) 0 July 18th 05 08:40 PM
import data using macro chris_rip Excel Discussion (Misc queries) 0 July 18th 05 08:32 PM


All times are GMT +1. The time now is 05:58 AM.

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"