Group:  Microsoft Word ยป microsoft.public.word.vba.userforms
Thread: Saving Files in word

DotNetBag
.NET Development Newsgroups

HTVi
TV Discussion Newsgroups

Our Hot Pick: Rising Antivirus 2006 - Certified by TUV & Checkmark! Get 10% discount by entering this coupon code: ONDISCOUNT10
Rising Antivirus 2006

Saving Files in word
Lumpjaw <moc.swen[ at ]news.com> 23.08.2006 10:26:24
Hello.

I realized this morning that a prievous post may not have been clead. =

This is what I a trying to do through a word userform.

I gather information from the user, this information among other things =
=

contain two parts to a folder name that will be created. Some of this =

information is also transfered into several Word documents. So...

I have a folder name that looks like this, after it is created.

c:\Job Files\B 06-100.Kodak Expansion\

Variables;
JobNumber =3D B 06-100
JobName =3D Kodak Expansion

I have several sub-folders of this newly created folder. I want to save=
=

say test.doc into
c:\Job Files\B 06-100.Kodak Expansion\Miscellaneous\

How can I save to this directory using the variable names, instead of th=
e =

file names, the reason is because this is always gonna change. Thanks f=
or =

the reply.




-- =

Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
Re: Saving Files in word
"Jean-Guy Marcil" <NoSpam[ at ]LeaveMeAlone> 23.08.2006 19:08:39
Lumpjaw was telling us:
Lumpjaw nous racontait que :

[Quoted Text]
> Hello.
>
> I realized this morning that a prievous post may not have been clead.
> This is what I a trying to do through a word userform.
>
> I gather information from the user, this information among other
> things contain two parts to a folder name that will be created. Some
> of this information is also transfered into several Word documents. So...
> I have a folder name that looks like this, after it is created.
>
> c:\Job Files\B 06-100.Kodak Expansion\
>
> Variables;
> JobNumber = B 06-100
> JobName = Kodak Expansion
>
> I have several sub-folders of this newly created folder. I want to
> save say test.doc into
> c:\Job Files\B 06-100.Kodak Expansion\Miscellaneous\
>
> How can I save to this directory using the variable names, instead of
> the file names, the reason is because this is always gonna change. Thanks
> for the reply.

ActiveDocument.SaveAs "C:\Job Files\" & JobNumber & "_" & JobName &
"\Miscellaneous\Test.doc"

I would recommend the "_" instead of the "." (dot) for the folder name as it
is easier to see and less prone to create errors.

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE[ at ]CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org


Re: Saving Files in word
"Lumpjaw" <moc.swen[ at ]news.com> 24.08.2006 10:39:50
Hi Jean-Guy,

This is my actual code line, and I get an invalid file name, any ideas?
I check the variables in the debugger and they do have the data in them.

Thanks


..SaveAs "C:\Job Files\" & JobNumber & "_" & JobName &
"\Miscellaneous\test.doc."







"Jean-Guy Marcil" <NoSpam[ at ]LeaveMeAlone> wrote in message
news:%235rCMeuxGHA.5068[ at ]TK2MSFTNGP02.phx.gbl...
[Quoted Text]
> Lumpjaw was telling us:
> Lumpjaw nous racontait que :
>
>> Hello.
>>
>> I realized this morning that a prievous post may not have been clead.
>> This is what I a trying to do through a word userform.
>>
>> I gather information from the user, this information among other
>> things contain two parts to a folder name that will be created. Some
>> of this information is also transfered into several Word documents. So...
>> I have a folder name that looks like this, after it is created.
>>
>> c:\Job Files\B 06-100.Kodak Expansion\
>>
>> Variables;
>> JobNumber = B 06-100
>> JobName = Kodak Expansion
>>
>> I have several sub-folders of this newly created folder. I want to
>> save say test.doc into
>> c:\Job Files\B 06-100.Kodak Expansion\Miscellaneous\
>>
>> How can I save to this directory using the variable names, instead of
>> the file names, the reason is because this is always gonna change. Thanks
>> for the reply.
>
> ActiveDocument.SaveAs "C:\Job Files\" & JobNumber & "_" & JobName &
> "\Miscellaneous\Test.doc"
>
> I would recommend the "_" instead of the "." (dot) for the folder name as
> it is easier to see and less prone to create errors.
>
> --
> Salut!
> _______________________________________
> Jean-Guy Marcil - Word MVP
> jmarcilREMOVE[ at ]CAPSsympatico.caTHISTOO
> Word MVP site: http://www.word.mvps.org
>


Re: Saving Files in word
"Doug Robbins - Word MVP" <dkr[ at ]REMOVECAPSmvps.org> 29.08.2006 03:49:36
Does the folder represent by the variables in C:\Job Files\" & JobNumber &
"_" & JobName &
"\Miscellaneous actually exist?

You can test using the ChDir statement and if you get an error 76 message it
means it does not so then you can use MkDir to create it.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"Lumpjaw" <moc.swen[ at ]news.com> wrote in message
news:OyVrtewyGHA.4496[ at ]TK2MSFTNGP03.phx.gbl...
[Quoted Text]
> Hi Jean-Guy,
>
> This is my actual code line, and I get an invalid file name, any ideas?
> I check the variables in the debugger and they do have the data in them.
>
> Thanks
>
>
> .SaveAs "C:\Job Files\" & JobNumber & "_" & JobName &
> "\Miscellaneous\test.doc."
>
>
>
>
>
>
>
> "Jean-Guy Marcil" <NoSpam[ at ]LeaveMeAlone> wrote in message
> news:%235rCMeuxGHA.5068[ at ]TK2MSFTNGP02.phx.gbl...
>> Lumpjaw was telling us:
>> Lumpjaw nous racontait que :
>>
>>> Hello.
>>>
>>> I realized this morning that a prievous post may not have been clead.
>>> This is what I a trying to do through a word userform.
>>>
>>> I gather information from the user, this information among other
>>> things contain two parts to a folder name that will be created. Some
>>> of this information is also transfered into several Word documents.
>>> So...
>>> I have a folder name that looks like this, after it is created.
>>>
>>> c:\Job Files\B 06-100.Kodak Expansion\
>>>
>>> Variables;
>>> JobNumber = B 06-100
>>> JobName = Kodak Expansion
>>>
>>> I have several sub-folders of this newly created folder. I want to
>>> save say test.doc into
>>> c:\Job Files\B 06-100.Kodak Expansion\Miscellaneous\
>>>
>>> How can I save to this directory using the variable names, instead of
>>> the file names, the reason is because this is always gonna change.
>>> Thanks for the reply.
>>
>> ActiveDocument.SaveAs "C:\Job Files\" & JobNumber & "_" & JobName &
>> "\Miscellaneous\Test.doc"
>>
>> I would recommend the "_" instead of the "." (dot) for the folder name as
>> it is easier to see and less prone to create errors.
>>
>> --
>> Salut!
>> _______________________________________
>> Jean-Guy Marcil - Word MVP
>> jmarcilREMOVE[ at ]CAPSsympatico.caTHISTOO
>> Word MVP site: http://www.word.mvps.org
>>
>
>


Re: Saving Files in word
Russ <drsN0SPAMmikle[ at ]hotmailD0Tcom.INVALID> 29.08.2006 08:39:42
Lumpjaw,

You don't want a period or full stop after test.doc ;
You may need to force quote marks before and after like the examples below
because you have spaces in the path. The test line is all on one line,
unless you purposely split it with a space character and underscore .

Dim JobNumber As String
Dim JobName As String
JobNumber = "12345"
JobName = "My Name"


MsgBox Chr(34) & "C:\Job Files\" & JobNumber & "_" & JobName &
"\Miscellaneous\test.doc" & Chr(34)

Or...

Dim JobNumber As Long
Dim JobName As String
JobNumber = 12345
JobName = "My Name"
'

MsgBox Chr(34) & "C:\Job Files\" & CStr(JobNumber) & "_" & JobName &
"\Miscellaneous\test.doc" & Chr(34)




[Quoted Text]
> Hi Jean-Guy,
>
> This is my actual code line, and I get an invalid file name, any ideas?
> I check the variables in the debugger and they do have the data in them.
>
> Thanks
>
>
> .SaveAs "C:\Job Files\" & JobNumber & "_" & JobName &
>
> "\Miscellaneous\test.doc."
>
>
>
>
>
>
>
> "Jean-Guy Marcil" <NoSpam[ at ]LeaveMeAlone> wrote in message
> news:%235rCMeuxGHA.5068[ at ]TK2MSFTNGP02.phx.gbl...
>> Lumpjaw was telling us:
>> Lumpjaw nous racontait que :
>>
>>> Hello.
>>>
>>> I realized this morning that a prievous post may not have been clead.
>>> This is what I a trying to do through a word userform.
>>>
>>> I gather information from the user, this information among other
>>> things contain two parts to a folder name that will be created. Some
>>> of this information is also transfered into several Word documents. So...
>>> I have a folder name that looks like this, after it is created.
>>>
>>> c:\Job Files\B 06-100.Kodak Expansion\
>>>
>>> Variables;
>>> JobNumber = B 06-100
>>> JobName = Kodak Expansion
>>>
>>> I have several sub-folders of this newly created folder. I want to
>>> save say test.doc into
>>> c:\Job Files\B 06-100.Kodak Expansion\Miscellaneous\
>>>
>>> How can I save to this directory using the variable names, instead of
>>> the file names, the reason is because this is always gonna change. Thanks
>>> for the reply.
>>
>> ActiveDocument.SaveAs "C:\Job Files\" & JobNumber & "_" & JobName &
>> "\Miscellaneous\Test.doc"
>>
>> I would recommend the "_" instead of the "." (dot) for the folder name as
>> it is easier to see and less prone to create errors.
>>
>> --
>> Salut!
>> _______________________________________
>> Jean-Guy Marcil - Word MVP
>> jmarcilREMOVE[ at ]CAPSsympatico.caTHISTOO
>> Word MVP site: http://www.word.mvps.org
>>
>
>

--
Russ

drsmN0SPAMikleAThotmailD0Tcom.INVALID

Home | Search | Terms | Imprint | Contact
Newsgroups Reader - provided by WiredBox.Net