topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Saturday October 12, 2024, 10:16 pm
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: Macro needed  (Read 7228 times)

SKesselman

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 318
    • View Profile
    • Donate to Member
Macro needed
« on: January 29, 2009, 12:38 AM »
Hi,

My BF needs a macro.
I have the complete description, but it is long and very detailed, so I'll start with the basics:

Based on data from fields in a template/form (date, reference number, etc.) where the macro runs:
Can a macro actually go into Explorer, check to see if a folder exists (for example, John_Doe),
then create one and name it if it does not,
then name the document automatically when he "Save(s) As"?
And, save the new document it in the new folder (or a different one, depending on the field entries) upon closing the document?

As usual, any help is appreciated...however, he does not want a full-blown program, just this specific macro.

Thanks,
Sarah
-Sarah

Target

  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 1,832
    • View Profile
    • Donate to Member
Re: Macro needed
« Reply #1 on: January 29, 2009, 01:01 AM »
short answer would be yes, but more info needed, eg what sort of documents are we talking about

SKesselman

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 318
    • View Profile
    • Donate to Member
Re: Macro needed
« Reply #2 on: January 29, 2009, 01:21 AM »
Sorry!
Word 2007 docx format.
-Sarah

Target

  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 1,832
    • View Profile
    • Donate to Member
Re: Macro needed
« Reply #3 on: January 29, 2009, 04:51 PM »
sorry, not sure I can help with this one (I don't have access to office 2007, or much experience with VBA coding for word)

having said that it seems pretty straight forward, though i have no idea what (if any) impact the new document format might have

SKesselman

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 318
    • View Profile
    • Donate to Member
Re: Macro needed
« Reply #4 on: January 29, 2009, 07:13 PM »
Regarding the file format, here's what I got from Microsoft:

Office Word 2007 XML macro-enabled template-.dotm
   
Stores macro code for use with other Word documents. Does not always contain macro code, but is configured to support macro code storage. Word documents created from a macro-enabled template do not inherit the VBAProject part of the template. By default, documents are saved as .docx files even when they are created from a Office Word 2007 XML macro-enabled template.
-Sarah

Target

  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 1,832
    • View Profile
    • Donate to Member
Re: Macro needed
« Reply #5 on: January 29, 2009, 07:49 PM »
still not promising anything, but do you have a template already?

you seem pretty sure about what you're looking for so I assume you do

SKesselman

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 318
    • View Profile
    • Donate to Member
Re: Macro needed
« Reply #6 on: January 30, 2009, 01:40 AM »
Target, thanks so much for your replies.

He has emailed me a template that I'll go over with him tonight...
I just want to make sure I'm understanding what I'm posting, and that I can relay his requests correctly.

Then, I will certainly post it ASAP.

Thanks, again!  :)
-Sarah

tide

  • Supporting Member
  • Joined in 2007
  • **
  • default avatar
  • Posts: 84
    • View Profile
    • Donate to Member
Re: Macro needed
« Reply #7 on: January 30, 2009, 02:23 AM »
VBA is the way to go. I only have a little experience with it but I'm impressed with what I was able to do with some Excel tasks (creating and maintaining student records and schedules) without too much effort. That involves reading data from files, formatting the spreadsheet, manipulating dates, printing results and saving files. Look into it!

I am reviewing some programs (OnScript, vbsedit, etc.) designed to help create scripts and they look like they may be very useful.

SKesselman

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 318
    • View Profile
    • Donate to Member
Re: Macro needed
« Reply #8 on: January 30, 2009, 01:57 PM »
I don't have access to office 2007...

He just tried to save it as an Office 2003 file, but it converted his fields into plain text.
Since the macro needs to extract data from fields specific to Office 2007, you would need it to write this macro.

Thank you for offering to help, though!  :)
-Sarah

SKesselman

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 318
    • View Profile
    • Donate to Member
Re: Macro needed
« Reply #9 on: January 30, 2009, 03:50 PM »
I am reviewing some programs (OnScript, vbsedit, etc.) designed to help create scripts and they look like they may be very useful.
Tide,
OnScript offers training videos at a reasonable price, so I might try this one. Not sure yet, but if I take the plunge, I'll let you know how it turns out.

Thanks.
-Sarah

Target

  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 1,832
    • View Profile
    • Donate to Member
Re: Macro needed
« Reply #10 on: January 31, 2009, 04:23 AM »
He just tried to save it as an Office 2003 file, but it converted his fields into plain text.
Since the macro needs to extract data from fields specific to Office 2007, you would need it to write this macro.

that doesn't necessarily mean that the code in the background is that different

if you can supply the details we can probably work something out (and I have no doubt there are others here who do use Office 2007 and are far more competent than I...)

SKesselman

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 318
    • View Profile
    • Donate to Member
Re: Macro needed
« Reply #11 on: January 31, 2009, 02:49 PM »
Description of the process:
The macro has to run at the end of the editing process (of a word document).

·                    I create my document,
·                    I enter all the information needed :

o   First name of the client,
o   Last name of the client,
o   Address of the client
o   Subject of the document,
o   Date of the document,
o   Recipient of the document,
o   Eventually (if the document is an answer to another document) the reference,
o   The text of the document

·                    Once all the above is done, I run the macro which will have to :

o   Create the reference number of the document,
o   Create the name of the document based on the model and save it in the appropriate folder.
 (The items above in bold are those which are used by the macro).

Description of the macro:

Begin
Check in my "Customers" folder if the customer already exists, then :

If yes :
Go to this folder
Check if the actual year folder (AAAA) is already created, then

If yes :
Go to this folder,

If no :
Create this folder (LASTNAME Firstname)
Go to this folder
Endif

If no :
Create this folder
Go to this folder
Create the actual year folder
Go to this folder.
Endif

Check in the actual folder if there are already some documents, then
If yes :
Increase the number (NN) of the last document by one (the last letter is the one who have the highest MMAANN number)

If No :
Set the number to one.
Endif

Create the reference number for the document and write it in the document,
Generate the name of the document, based on a standard model,
Save the document.
End.
-Sarah