Save As Variable File Name

totalnovice2

Registered User.
Local time
Today, 22:33
Joined
May 21, 2013
Messages
36
Hi.

I have also posted this in the "reports" section as I wasn't sure where it would go.

I have looked around on the threads and don't seem to be able to find the answer.



I currently have a working model which opens up a word document template, fills the bookmarks with info from access, saves the file as a preset name and then send the document on Outlook.

What I would like to do is save the document as a variable, preferably as something like " Climbing Request for site (and then to lift the site name from Access form field and insert here) "

E.G " Climbing Request - Newcastle Central Station.doc"

The location of the site name on access is...

Code:
objWord.Selection.Text = Forms![Front Page]![Site 2 Owner]

currently I save the document using the below code...

Code:
objWord.ActiveDocument.SaveAs2 FileName:="C:\Users\me\desktop\From Colin\o2test.docx"

Any help would be really appreciated as this is the last step before "launching" my database automation.



Many thanks. :)
 
Last edited:
Your description is vague.. What is happening and what is not?

Does the above code not work?? It looks like it is referring to the Form controls.. Is there any error message? Is the Subject not being set? What is the problem?
 
Hi.

All I want to do is save the file name as a variable. Everything works with the above code.

Currently it saves at o2test.doc but I would like to name it the piece of text linked to a field the form on access. This text will be different depending on what info users enter.

I added the additional code as I don't know exactly what peple would need to be able to help.

cheers.
 
I have deleted the additional code from the above post as it did make it look like there were issues with it when there aren't.

I hope the above is clearer now.
 
Okay how about..
Code:
objWord.ActiveDocument.SaveAs2 FileName:="C:\Users\me\desktop\From Colin\" & Forms![Front Page]![Site 2 Owner] & ".docx"
 
That works great.

I knew it would be something along these lines but I am not quite there yet to work these things out.

Thanks very much
 
Last edited:
You will be there someday.. :) Good Luck..
 
Last edited:

Users who are viewing this thread

Back
Top Bottom