Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Variable into new file name

Hi everyone,

I am using UserForm3 to gather information for the procedure below.
UserForm3.TextBox4.Text is the filename which my user will have chosen
to use.


I am assigning it a variable name ( filename = UserForm3.TextBox4.Text
).


Please, can someone tell me how to get that variable into the
CreateTextFile
action below, as I am currently stuck using a fixed filename of
customscan.cmd which
is inflexible.


I know that this code is probably extremely ugly - but I am just
starting with xlVBA and
learning all the time :-))


scan_with_sccs:
' Create the custom scanner .cmd file & populate with choices from
userform3
Set fs = CreateObject("Scripting.FileSystemObject")
Set a = fs.CreateTextFile("C:\Hotfixer\customscan.cmd", True)
a.WriteLine "cd \Hotfixer"
a.WriteLine ""
a.WriteLine "HfNetChk -h " & HostName _
& " -u " & UserID _
& " -p " & Pass _
& " -s 2 -nosum" _
& " -fq ""C:\Hotfixer\sccsignore.txt""" _
& " -f ""C:\Hotfixer\Results\customscan" & ".txt""" _
& " -x ""C:\Hotfixer\mssecure.xml"""
a.Close
GoTo scan_now


Many thanks,


Stuart

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Variable into new file name


& " -f ""C:\Hotfixer\Results\" & filename & ".txt""" _

--

HTH

Bob Phillips

(remove nothere from the email address if mailing direct)

"krayten" wrote in message
oups.com...
Hi everyone,

I am using UserForm3 to gather information for the procedure below.
UserForm3.TextBox4.Text is the filename which my user will have chosen
to use.


I am assigning it a variable name ( filename = UserForm3.TextBox4.Text
).


Please, can someone tell me how to get that variable into the
CreateTextFile
action below, as I am currently stuck using a fixed filename of
customscan.cmd which
is inflexible.


I know that this code is probably extremely ugly - but I am just
starting with xlVBA and
learning all the time :-))


scan_with_sccs:
' Create the custom scanner .cmd file & populate with choices from
userform3
Set fs = CreateObject("Scripting.FileSystemObject")
Set a = fs.CreateTextFile("C:\Hotfixer\customscan.cmd", True)
a.WriteLine "cd \Hotfixer"
a.WriteLine ""
a.WriteLine "HfNetChk -h " & HostName _
& " -u " & UserID _
& " -p " & Pass _
& " -s 2 -nosum" _
& " -fq ""C:\Hotfixer\sccsignore.txt""" _
& " -f ""C:\Hotfixer\Results\customscan" & ".txt""" _
& " -x ""C:\Hotfixer\mssecure.xml"""
a.Close
GoTo scan_now


Many thanks,


Stuart



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Variable into new file name

Have you tried

Set a = fs.CreateTextFile("C:\Hotfixer\" & filename, True)

Martin


"krayten" wrote:

Hi everyone,

I am using UserForm3 to gather information for the procedure below.
UserForm3.TextBox4.Text is the filename which my user will have chosen
to use.


I am assigning it a variable name ( filename = UserForm3.TextBox4.Text
).


Please, can someone tell me how to get that variable into the
CreateTextFile
action below, as I am currently stuck using a fixed filename of
customscan.cmd which
is inflexible.


I know that this code is probably extremely ugly - but I am just
starting with xlVBA and
learning all the time :-))


scan_with_sccs:
' Create the custom scanner .cmd file & populate with choices from
userform3
Set fs = CreateObject("Scripting.FileSystemObject")
Set a = fs.CreateTextFile("C:\Hotfixer\customscan.cmd", True)
a.WriteLine "cd \Hotfixer"
a.WriteLine ""
a.WriteLine "HfNetChk -h " & HostName _
& " -u " & UserID _
& " -p " & Pass _
& " -s 2 -nosum" _
& " -fq ""C:\Hotfixer\sccsignore.txt""" _
& " -f ""C:\Hotfixer\Results\customscan" & ".txt""" _
& " -x ""C:\Hotfixer\mssecure.xml"""
a.Close
GoTo scan_now


Many thanks,


Stuart


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
calling a value from another file using a variable in the file nam DA_Potts[_2_] Excel Worksheet Functions 3 December 3rd 07 12:25 AM
calling a value from another file using a variable in the file nam DA_Potts[_2_] Excel Discussion (Misc queries) 4 December 2nd 07 11:09 PM
PASSING VARIABLE TO .xlT FILE FROM .xlA FILE (CONTAINS 'Auto_Open' PROCEDURE) Chuckles123[_113_] Excel Programming 0 September 9th 05 07:31 PM
Using a variable file name Utkarsh Majmudar[_2_] Excel Programming 3 September 23rd 04 05:46 PM
Variable File Name Trevor[_4_] Excel Programming 3 June 18th 04 07:10 PM


All times are GMT +1. The time now is 03:01 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"