Results 1 to 6 of 6
  1. #1
    4 Star Lounger
    Join Date
    Jun 2001
    Posts
    531
    Thanks
    0
    Thanked 0 Times in 0 Posts

    SAVE AS with help of text box (97)

    SAVE AS with help of text box
    I

  2. #2
    Bronze Lounger
    Join Date
    Jun 2001
    Location
    New York, New York, Lebanon
    Posts
    1,449
    Thanks
    1
    Thanked 1 Time in 1 Post

    Re: SAVE AS with help of text box (97)

    <img src=/S/hello.gif border=0 alt=hello width=25 height=29> arage

    I like "is this possible" kind of questions.

    Yes it is possible. Check the Inputbox in the OLH.

    It says that you can have the following parts: InputBox(prompt[, title] [, default] [, xpos] [, ypos] [, helpfile, context])

    So you can use the Default section to populate the Inputbox. <font color=red>BUT</font color=red> You should also write some VBA code to move the cursor to the end of the line, so that you can start typing.

    I do have an example, but try it first on your own, until I dig out the example. Its going to take me about 3 weeks to dig it out. I am reorganizing my files and now most of them are on Zip disks.

    Good luck.

    Wassim <img src=/S/compute.gif border=0 alt=compute width=40 height=20>
    <img src=/S/compute.gif border=0 alt=compute width=40 height=20> in the <img src=/S/bagged.gif border=0 alt=bagged width=22 height=22>

  3. #3
    2 Star Lounger
    Join Date
    May 2002
    Location
    Midland, Michigan, USA
    Posts
    133
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: SAVE AS with help of text box (97)

    Try this:

    Sub Button1_Click()
    'Copies the workbook to a separate file
    Dim FileName As String
    Dim thePath


    thePath = "C:YourDirectoryHere" ' That last '' is important
    FileName = "New File " & Format(Date, "mm-dd-yyyy") 'Suggested Filename

    Application.Dialogs(xlDialogSaveAs).Show thePath & FileName ' Save As box
    Application.DisplayAlerts = False '-----=====-----
    ActiveWorkbook.Close ' Comment these out to leave the new file open
    Application.DisplayAlerts = True '-----=====-----
    End Sub

  4. #4
    4 Star Lounger
    Join Date
    Jun 2001
    Posts
    531
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: SAVE AS with help of text box (97)

    Thanks Wassim, I tentatively began work using the inputBox function before Smerdon

  5. #5
    4 Star Lounger
    Join Date
    Jun 2001
    Posts
    531
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: SAVE AS with help of text box (97)

    Thanks Smerdon, it worked great.

  6. #6
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Weert, Limburg, Netherlands
    Posts
    4,812
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: SAVE AS with help of text box (97)

    Saving a copy of the current workbook without changing its name can be done using the savecopyas method:

    Sub wkbkSaveAsCopy()
    Dim vFilename As Variant 'will hold the filename entered
    Dim sOldDrive As String
    Dim sOldDir As String
    sOldDrive = Left(CurDir, 1)
    sOldDir = CurDir
    ChDrive "c"
    ChDir "c:data"
    vFilename = Application.GetSaveAsFilename("YourDefaultFileName " & Format(Now, "dd-mm-yyyy"), , , "Please enter a filename")
    If TypeName(vFilename) = "Boolean" Then GoTo tidyup 'cancelled
    If vFilename = "" Then GoTo tidyup 'nothing entered
    ActiveWorkbook.SaveCopyAs vFilename
    tidyup:
    ChDrive sOldDrive
    ChDir sOldDir
    End Sub
    Jan Karel Pieterse
    Microsoft Excel MVP, WMVP
    www.jkp-ads.com
    Professional Office Developers Association

Posting Permissions

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