+ Reply to Thread
Results 1 to 7 of 7

Saving excel spreadsheet via userform

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    09-08-2011
    Location
    Leicester, England
    MS-Off Ver
    Excel 2007
    Posts
    157

    Saving excel spreadsheet via userform

    i'm trying to save the data inputted from the userform thats been written out to excel.

    Aim is to click a save button and from their it will prompt the browse directories etc where they want to save but the name is already preset.

    ThisWorkbook.SaveAs "C:\Users\u544835\Documents\HPC Requests.xls"

    this doesnt let me choose the location etc via browse I have to use the preset folder and name when I click a button, I want to click a button then the browse comes up to what location and name etc

    any help kindly appreciated
    Last edited by kieranbop; 09-13-2011 at 08:43 AM.

  2. #2
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,239

    Re: Saving excel spreadsheet via userform

    You'd use something like:

    TheFile = Application.GetSaveAsFilename("YOURPATH\", "Workbook (*.xls), *.xls", , "Save Data:")
    
    If TheFile = False Then
                            MsgBox "You cancelled"
                            Exit Function
                        Else
                            ActiveWorkbook.SaveAs filename:=TheFile
    End If

  3. #3
    Valued Forum Contributor mohd9876's Avatar
    Join Date
    05-04-2011
    Location
    Amman, Jordan
    MS-Off Ver
    Excel 2010
    Posts
    426

    Re: Saving excel spreadsheet via userform

    Dim dlgFileDlg As FileDialog
    Dim sFolderName As String
    Const sFileName = "SampleFileName"
    Set dlgFileDlg = Application.FileDialog(msoFileDialogFolderPicker)
    With dlgFileDlg
        .AllowMultiSelect = False
        If .Show = -1 Then
            ActiveWorkbook.SaveAs .SelectedItems(1) & "\" & sFileName
        End If
    End With

  4. #4
    Forum Contributor
    Join Date
    09-08-2011
    Location
    Leicester, England
    MS-Off Ver
    Excel 2007
    Posts
    157

    Re: Saving excel spreadsheet via userform

    thanks both guys, If I wanted to load a file how would that work.

    As in the sense of hitting the button again then going to browsing to select a excel value to read it's contents in certain rows/columns If any of you two have an idea?

  5. #5
    Valued Forum Contributor mohd9876's Avatar
    Join Date
    05-04-2011
    Location
    Amman, Jordan
    MS-Off Ver
    Excel 2010
    Posts
    426

    Re: Saving excel spreadsheet via userform

    what do you mean exactly? do you want to open a workbook whose path is stored in a cell?
    could you submit an example to what you are asking?

  6. #6
    Forum Contributor
    Join Date
    09-08-2011
    Location
    Leicester, England
    MS-Off Ver
    Excel 2007
    Posts
    157

    Re: Saving excel spreadsheet via userform

    I ideally want to click a button, then the file browsing loads up and select and excel document. it either needs to open it, preferably not then I get to extract certain rows of data from that excel document and put it into another.

    Name Phone ID
    K.green 21972957 u14714
    y.h 14215 u21489
    T.T 258 T14021
    j.test 14215 u14521

    This is the data inside the document, I'm trying to open so I would say something like read column A(Names) until no more text then read information across in all other corresponding rows.

  7. #7
    Forum Contributor
    Join Date
    09-08-2011
    Location
    Leicester, England
    MS-Off Ver
    Excel 2007
    Posts
    157

    Re: Saving excel spreadsheet via userform

    Heres the file, Let's say I want to do a macro now instead to write the sheets
    "CourseBooking"
    and
    "Course 2"
    and then they both write eachother out together in sheet 3!

    They wont always be a set range so I would need a condition to stop when it's empty surely? in the rows I mean?

    ie some might have 6 rows, some sheets might have 200 etc
    Attached Files Attached Files

+ 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.6.0 RC 1