PDA

View Full Version : auto saving using macro



toothpaste
10-13-2005, 02:22 AM
Hi all,

2 questions here.

1st:
Attached is a file where by i try and state the path name and file name to save by in excel and then try executing it using a macro. I've seen others doing it but whenever i run it prompts a 'object required' error.

2nd:
in cell D14 i used this formula "=TEXT(date,"ddmm")". My question is why does it always reference cell E2?

Thanx in advance for all yr help

Bob Phillips
10-13-2005, 02:45 AM
Attached is a file where by i try and state the path name and file name to save by in excel and then try executing it using a macro. I've seen others doing it but whenever i run it prompts a 'object required' error.

You do not have Excel names For ArchivePath and ArchiveFile, so it cannot use them. You need to define the names oor use


archivePath = Sheets("Control").Range("D6").Value
archiveFile = Sheets("Control").Range("D7").Value



in cell D14 i used this formula "=TEXT(date,"ddmm")". My question is why does it always reference cell E2?

Because you have an Excel name of 'date' referring to cell E2, so it picks up that. I think that you mean

=TEXT(TODAY(),"ddmm")

toothpaste
10-14-2005, 07:30 PM
You do not have Excel names For ArchivePath and ArchiveFile, so it cannot use them. You need to define the names oor use


archivePath = Sheets("Control").Range("D6").Value
archiveFile = Sheets("Control").Range("D7").Value




Because you have an Excel name of 'date' referring to cell E2, so it picks up that. I think that you mean

=TEXT(TODAY(),"ddmm")

Thank you for your response. How do u define names for ArchivePath, ArchiveFile to make the original VBA work? And how does one make the 'date' reference to E2 cell? If i want to define E3 cell using the name 'mummy' how should it be done then?

Bob Phillips
10-15-2005, 03:44 AM
Thank you for your response. How do u define names for ArchivePath, ArchiveFile to make the original VBA work?

Why not just use the code I gave, those cells have the value?


And how does one make the 'date' reference to E2 cell? If i want to define E3 cell using the name 'mummy' how should it be done then?

E2 is empty, what do you mean '... make the date reference E2 ...'? What do you mean define E3 using the name 'mummy'?

Shazam
10-15-2005, 09:28 AM
Thank you for your response. How do u define names for ArchivePath, ArchiveFile to make the original VBA work? And how does one make the 'date' reference to E2 cell? If i want to define E3 cell using the name 'mummy' how should it be done then?


Are these the formulas you are looking for?


=TEXT(NOW(),"mm-dd-yyyy")

I'm asuming your reference in F2 not E2

=TEXT(F2,"mm-dd-yyyy")