Results 1 to 2 of 2

Access an pre formatted excel through user form

Threaded View

  1. #1
    Registered User
    Join Date
    06-28-2011
    Location
    Michigan, USA
    MS-Off Ver
    Excel 2007/2010
    Posts
    1

    Question Access an pre formatted excel through user form

    Hi all,

    I am new to VB programming. I come from no programming background but was able to play around with some macro stuff solely due to this forum. Have got lots of help from here. Have been referring this site for almost a month now!! A million thanks to all the users out here.

    I have 2 questions and this is my first post ever here.(Hope you guys find my question clear. If its confusing I will try my best to explain. Plz bear with me! )

    1. I have a user form, I want the users to be able to open an excel file (which has specific headers already) on click of the command button.

    2. The users should be able to access this opened file and type in their values. So in all, I need my excel file to act like an input file.(I mean, the values entered must be read -> the rows are variable but the columns in the file are fixed. My file would not be too huge. I will only have 9 columns which needs to be read and interpreted by my program.)

    The code to open the excel file through user form is below.The problem is it is entering an infinite loop and I am not able to figure out how to correct it. I got this part of coding too from this forum have slightly modified it to suit my userform.

    "http://www.excelforum.com/excel-general/519123-opening-an-excel-file-from-a-userform.html

    To make it more clear I am attaching the snapshot of my userform.

    Private Sub Cmd_open_excel_Click()
    Call OpenExcelFile("C:\Documents and Settings\Desktop\Book1.xlsx")
    End Sub
    
    Public Function OpenExcelFile(ByVal File_Name As String) As Boolean
    Dim oWB As Workbook
    Dim Res As Integer
    On Error Resume Next
    Set oWB = Workbooks.Open(File_Name)
    On Error GoTo 0
    Res = OpenExcelFile("C:\Documents and Settings\Desktop\Book1.xlsx")
    If Res Then
    UserForm1.Show vbModeless
    End If
    End Function
    I look forward for your help and I greatly appreciate it.

    Thank you,
    Taylor.
    Last edited by Leith Ross; 06-28-2011 at 06:26 PM. Reason: Removed HTML and Added Link to the Post

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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