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.
Bookmarks