VBA Excel macro 'File Save As ....' problem 
Author Message
 VBA Excel macro 'File Save As ....' problem

Hi

I have written a macro which would ask the user a name, the name is
then entered in a particular cell of the sheet and saved as
'<name>.xls'.  But the new xls file created also asks for a name when
opened. Kindly help me out to prevent this macro getting run in the
file created.

Thanx in advance
Kannan



Sat, 04 Jun 2005 14:46:15 GMT  
 VBA Excel macro 'File Save As ....' problem
Maybe you could check that cell first.  If it's filled in, then don't ask.

in auto_open or workbook_open

        if isempty(worksheets("sheet1").range("a1")) then
             'ask the questions
        else
             'don't ask, don't tell.
        end if

If your macro created the workbook and then saved it, you could also check to
see if the workbook's path existed.  If it does, then it's been saved at least
once before.

Same spot:

        if thisworkbook.path = "" then
            'get name
        else
            'opening an existing file
        end if

Quote:

> Hi

> I have written a macro which would ask the user a name, the name is
> then entered in a particular cell of the sheet and saved as
> '<name>.xls'.  But the new xls file created also asks for a name when
> opened. Kindly help me out to prevent this macro getting run in the
> file created.

> Thanx in advance
> Kannan

--

Dave Peterson



Sun, 05 Jun 2005 01:24:17 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. saving excel-macro's as a separate file

2. Macro Problem: VB won't run Excel VBA code

3. Can't save Excel file w/macro

4. Macro written in VBA Excel 2000 doesn't work in Excel 97

5. Excel 'Save As' Problem

6. Excel macro 'Variable' problem

7. can't save a excel 2002 file as a excel 2000 format correctly

8. Excel 97 - file can't use file save>options>passwords

9. New Formulation of 'Sticky Excel File'-problem

10. excel -97 can't open excel -95 files if they include macros


 
Powered by phpBB® Forum Software © phpBB Group