strongm and N1GHTEYES, you guys have been a HUGE help!
I avoided using the Public variable declaration as I understand that can be dangerous and instead am using the Public Properties. N1GHTEYES, I made the changes you recommended and I now have that GetData property working for all variables...
I assign InsString here:
Private Sub cmdCancel_Click()
Unload Me
End Sub
Private Sub cmdOK_Click()
MonthDay = YYMM.Text
InsString = cboCoord.Text
CalDate = cboDay.Text
Hide
End Sub
Public Property Get GetData() As Variant
GetData = InsString
End Property
Private Sub...
Tony,
Here are the adjustments I made:
Module:
Option Explicit
Dim MonthDay As String
Dim InsString As String
Dim CalDate As String
Sub InputDate()
FindInput.Show
InsString = FindInput.GetData
Call ImportData
End Sub
Sub ImportData()
Workbooks.OpenText...
Skip,
InsString is supposed to be filled by the UserForm value for the ComboBox.
Tony,
Thank you very much for writing that out for me, I'll implement that now and see how things go.
Hey all,
I've got a VBA module that runs a userform that prompts for a certain set of data, finds and opens a file based on the user input, inputs and formats that data, and saves to a new directory. I'm having difficulties passing the data as variables from the UserForm I created back to the...
Skip,
Sorry for the confusion, I now understand the differences between the two.
I've revised my entire code, now working much better. Thank you so much for guiding me through these first through difficult days of misunderstanding :)
I originally wanted to run the code just as a .vbs file written in notepad, but because of the excessive difficulties I have decided to rewrite it. Now I have a macro that runs in Excel - user opens and imports data using wizard, then runs macro which formats and saves file into new directory.
To run the script external to Excel, have it import and format the data, and close.
I don't plan to reference this workbook anywhere else, I just want to open, import, format, save, close, repeat.
So this is coded in Excel, but my ultimate goal is to run this external to Excel and have the script open and process all the data for me.
Because theres a large number of files, I want to have a script that I run separately that grinds through each data import for me. I could easily just do...
The following is the rearranged first few lines of my code:
Option Explicit
Dim objXL
Sub AddNew()
Set NewBook = Workbooks.Add
With NewBook
.Title = "TEST"
.Subject = "TEST"
.SaveAs Filename="TEST.xlsm"
End With
End Sub
Set objXL = CreateObject("Excel.Application")
objXL.Visible =...
Skip,
Thanks for clarifying, I read up about procedure-module-project level variables and it makes more sense now.
Now, I rearraged the code such that Sub AddNew is now above the object declaration for objXL. I have not changed any of the merge and/or selection commands just yet, but thats...
I really am new to this so could you clarify a little more what you mean by not placing a code above procedure?
Secondly, when I use the Option Explicit command, it requires that I declare all variables. I am a little confused about the objXL object being a variable, must be my unfamiliarity...
Hey all, I'm new to this forum and VB in general (only been using for 2 days now) and I need some help executing a text import into Excel.
I've got a series of text files with columns of data that import just fine into Excel using the Import Data Wizard, but I'd like to automate this process...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.