+ Reply to Thread
Results 1 to 3 of 3

Thread: Variable into new file name

  1. #1
    krayten
    Guest

    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. #2
    Bob Phillips
    Guest

    Re: Variable into new file name


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

    --

    HTH

    Bob Phillips

    (remove nothere from the email address if mailing direct)

    "krayten" <krayten@yahoo.co.uk> wrote in message
    news:1139572600.435399.214000@g14g2000cwa.googlegroups.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. #3
    Martin Yirrell
    Guest

    RE: 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 to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.2.0