Help!

From: Kevin (anonymous_at_discussions.microsoft.com)
Date: 09/16/04


Date: Thu, 16 Sep 2004 08:05:19 -0700

I have an Excel application which is based on two files:
1) a menu which the user will use to access the
application. Eventually this menu will allow the user to
do a number of things such as maintain static data used
for lookups etc. Currently I am trying to impliment two
features from this menu. (a) Open an existing data file
and (b) open a new data file based on a template. I am
having problems with both.
2) a template data file.

If I create a new data file based on the template, I need
to run a function that is contained in a standard module
within the template file. I posted a question on this the
other day and had two people suggest using
Application.Run. When I do this my code looks something
like this:

Application.Run "myTemplate!routineName", parameter

When I run the code I get an error message saying that it
can't find the macro. I tried putting in the path name
like this - C:\MyDir\myTemplate!routineName so the code
would look like this:

Application.Run "C:\MyDir\myTemplate!routineName",
parameter

This did not correct the problem.

Help says this command will run a macro written in Visual
Basic or the Microsoft Excel macro language, or to run a
function in a DLL or XLL.

I am also having a problem when I open an existing file. I
posted a question on this yesterday and got no response so
I will ask again.

I am using the following code to open the file:

    fToOpen = Application.GetOpenFilename("Excel Files
(*.xls), *.xls")
    Workbooks.Open fileName:=fToOpen

When this runs, I get the file with a 1 at the end. If the
file I am opening is "Test.xls" the file is opened
as "Test1.xls".

Any help would be greatly appreciated!

Kevin



Relevant Pages

  • Re: Type mismatch on field result statement sending from Excel
    ... When a macro is running in Word, you can identify a field by its numeric ... only) field in the range of the named bookmark: ... and have Excel just create the new document. ... I have one Excel document and one Word document template in this ...
    (microsoft.public.word.vba.general)
  • Re: exporting to Excel without overwriting the macros
    ... A client exports a file out of Crystal reports to Excel. ... have the Excel macro, obviously. ... template or spreadsheet or csv file or whatever and allow for the macro to ...
    (microsoft.public.excel.programming)
  • Re: How to use templates with macros
    ... In excel 2007 you need to set the FileFormat option when you use SaveAs: ... Private Sub CommandButton1_Click ... 'Save as Macro enabled template ... I have a template which I used for years with excel 2003, ...
    (microsoft.public.excel.programming)
  • Re: Transfertext with date in file name.
    ... I tried this outputting to excel and I get the following error, ... -If you are using a template, check to make sure the template exits. ... >> I'm trying to transfer a query in a macro to a text file. ...
    (microsoft.public.access.macros)
  • Re: Simple macro used to work...?
    ... I have tested your code (changing only the templatename and the data file) ... This macro puts the firstname field ... from the data file into a table (the template), ... merges to the ActivePrinter. ...
    (microsoft.public.word.docmanagement)

Loading