Consulting

Results 1 to 5 of 5

Thread: auto saving using macro

  1. #1

    auto saving using macro

    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

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Quote Originally Posted by toothpaste
    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

    [VBA]
    archivePath = Sheets("Control").Range("D6").Value
    archiveFile = Sheets("Control").Range("D7").Value
    [/VBA]

    Quote Originally Posted by toothpaste
    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")
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    Quote Originally Posted by xld
    You do not have Excel names For ArchivePath and ArchiveFile, so it cannot use them. You need to define the names oor use

    [VBA]
    archivePath = Sheets("Control").Range("D6").Value
    archiveFile = Sheets("Control").Range("D7").Value
    [/VBA]



    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?

  4. #4
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Quote Originally Posted by toothpaste
    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?

    Quote Originally Posted by toothpaste
    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'?
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  5. #5
    VBAX Expert Shazam's Avatar
    Joined
    Sep 2005
    Posts
    530
    Location
    Quote Originally Posted by toothpaste
    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")

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •