473,396 Members | 2,003 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Can I assign the value of a variable to a filename ?

Hello all,
I have made a form which takes input from the user (things like name,adress,
reference number and so on). After filling in the form, the user presses a
button. The program then takes all the values out of the controls, opens MS
Word and uses these values to compose a letter with all the data pre-filled
in. Now my question is : Can I make a variable, containing some text which
comes out of the controls of the form and use this variable to define the
filename?
do it would look like :
*****
Me!Myform!Textbox1.value = "Myname"
Me!Myform!Textbox2.value= "EG"
Me!Myform!Textbox3.value= "JK"
Dim sNameFile as String
sNameFile = Me!Myform!Textbox1.value & "_"& Me!Myform!Textbox2.value & _
"_" & Me!Myform!Textbox3.value
*****
So now sNameFile contains the name with which the file shoul be saved. Thus
on disk, in the explorer the file should look like : Myname_EG_JK.doc
Is this possible and what is the correct syntax ?
Save as .............
Can anybody help me with this ?
Thanks !!!!


Nov 12 '05 #1
2 2313
"Ronny Sigo" <ro********@skynet.be> wrote in message news:<3f***********************@reader0.news.skyne t.be>...
Hello all,
I have made a form which takes input from the user (things like name,adress,
reference number and so on). After filling in the form, the user presses a
button. The program then takes all the values out of the controls, opens MS
Word and uses these values to compose a letter with all the data pre-filled
in. Now my question is : Can I make a variable, containing some text which
comes out of the controls of the form and use this variable to define the
filename?
do it would look like :
*****
Me!Myform!Textbox1.value = "Myname"
Me!Myform!Textbox2.value= "EG"
Me!Myform!Textbox3.value= "JK"
Dim sNameFile as String
sNameFile = Me!Myform!Textbox1.value & "_"& Me!Myform!Textbox2.value & _
"_" & Me!Myform!Textbox3.value
*****
So now sNameFile contains the name with which the file shoul be saved. Thus
on disk, in the explorer the file should look like : Myname_EG_JK.doc
Is this possible and what is the correct syntax ?
Save as .............
Can anybody help me with this ?
Thanks !!!!


Ronny,
sure. This is cake. You just build the filename (be sure to include
the full path), so your full path would be something like:

C:\Dir1\SubDir1\Filename.doc

as long as you have that built, you can pass that value to your Word
automation stuff and just do something like

appWord.SaveAs strSaveFile

(Sorry, can't remember the exact syntax in Word...)

HTH a little,

Pieter
Nov 12 '05 #2
Thank you :)
I will only be able to try this tomorrow, but I am sure this will work !

"Ronny Sigo" <ro********@skynet.be> wrote in message
news:3f***********************@reader0.news.skynet .be...
Hello all,
I have made a form which takes input from the user (things like name,adress, reference number and so on). After filling in the form, the user presses a
button. The program then takes all the values out of the controls, opens MS Word and uses these values to compose a letter with all the data pre-filled in. Now my question is : Can I make a variable, containing some text which
comes out of the controls of the form and use this variable to define the
filename?
do it would look like :
*****
Me!Myform!Textbox1.value = "Myname"
Me!Myform!Textbox2.value= "EG"
Me!Myform!Textbox3.value= "JK"
Dim sNameFile as String
sNameFile = Me!Myform!Textbox1.value & "_"& Me!Myform!Textbox2.value & _
"_" & Me!Myform!Textbox3.value
*****
So now sNameFile contains the name with which the file shoul be saved. Thus on disk, in the explorer the file should look like : Myname_EG_JK.doc
Is this possible and what is the correct syntax ?
Save as .............
Can anybody help me with this ?
Thanks !!!!

Nov 12 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Mike | last post by:
Is there any way I can use a function to create a variable and assign a value to it? I have a Perl script that returns some LDAP information: sn=Shore givenname=Mike logintime=20041008153445Z...
25
by: Rim | last post by:
Hi, I have been thinking about how to overload the assign operation '='. In many cases, I wanted to provide users of my packages a natural interface to the extended built-in types I created for...
2
by: Matt | last post by:
If I assign VBScript server side variable a to javascript variable x, it is fine. <% Dim a, b a = 10 %> var x = <%= a %>; alert(x); But if I do the other way around, then it has 500 error....
4
by: Terry | last post by:
I have a number of input boxes used to display totals based on selected items for each row in a table. There are more than a few rows that are identical, except for the form field name. I have...
4
by: Eric | last post by:
How can I dynamically assign an event to an element? I have tried : (myelement is a text input) document.getElementById('myelement').onKeyUp = "myfnc(param1,param2,param3)"; ...
2
by: Jim McGivney | last post by:
In asp 2.0 I am trying to insert a row using a detailsview control connected to an accessDataSource. I get the error message below. I am having trouble identifing which data field is causing the...
6
by: david | last post by:
I try to use "for" loop to retrieve and assign values in web form. The code is in the following. But it can not be compiled. What I want to do is: txtQ1.Text =...
2
by: Birky | last post by:
Assign the output of a select to a variable? I am unable to find a way to assign the results of an SQL statement to a variable. I know how to assign the SQL statement to a variable but again no...
1
by: Tony Bansten | last post by:
Assume I want to concatenate a literal text value and a variable value for a function parameter then the following does NOT work: objWorkbook.SaveAs("D:\work\v1_" + Filename) The variable...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.