Due to this being more difficult for me than I anticipated, I have decided to go in a different direction with this whole process. I think to simplify it for me I will create the different subroutines and fire them off at the appropriate time rather then have 1 sub do all the work. I realize...
Well, I tried as you suggested but still came up with the same error. When I run with the code you provided I get some different results in the line giving the error than when I did before. Ubound(lastnum) now = 4, lastnum(Ubound(lastnum)-1 = "2011 06 16 0003", str = "2011 06 16 0003"
You did...
Ok, so with your patience and gentle nudging I pondered your response above and think I am making small baby steps towards understandiing. I did some research and came up with the following modifications in my functions:
Function nextnum(ByVal s As String) As String
Function MySplit(ByVal s...
Well really all I see if I go back to your earlier post you said to change Split to MySplit so I changed the code to be:
lastnum = MySplit(MySplit(s, "(")(0), "")
Is this what you are refering to?
When I run the code with it changed to this I now get a "byref argument type mismatch"
I feel...
Here is what I now have:
Sub QC_LOG_FIND()
Dim ofso, ofile, sPrevFile As String
Set ofso = CreateObject("scripting.filesystemobject")
For Each ofile In ofso.GetFolder("D:\QC_TEMP_CHECKS_LOG\QC TEMP CHECKS\").Files
If sPrevFile < ofile.Name Then sPrevFile = ofile.Name
Next
MsgBox...
"Can we just find out what application you are currently using to host your VBA? "
Certainly!! The VBA is part of a SCADA software called RSVIEW32 which is made by Allen Bradley.
Skip,
I will try your suggestion regarding the "MySplit" you suggested and report back.
Thanks
Tom
Excel was recently added to the computer that runs this application. I have it added to the references so I would assume it could be used in my VBA code right? This would be preferable as I would also at a later time like to use Excel to modify the created file. That part is for a later time...
I now have the following code:
Sub QC_LOG_FIND()
Dim ofso, ofile, sPrevFile As String
Set ofso = CreateObject("scripting.filesystemobject")
For Each ofile In ofso.GetFolder("D:\QC_TEMP_CHECKS_LOG\QC TEMP CHECKS\").Files
If sPrevFile < ofile.Name Then sPrevFile = ofile.Name
Next
MsgBox...
Here is a copy of the code:
Function nextnum(s As String) As String
Dim lastnum
lastnum = Split(Split(s, "(")(0), " ")
nextnum = Format(CInt(lastnum(UBound(lastnum) - 1)) + 1, "0000")
Dim ofso, ofile, sPrevFile As String
Set ofso = CreateObject("scripting.filesystemobject")
For Each ofile In...
I hope I am doing this correctly. When I highlight s, click on DEBUG,then click on ADD WATCH the following comes up at the bottom of the screen:
Watch : : s : <Can't compile module> : Empty : ThisProject.nextnum
When I go to DEBUG then COMPILE I get an UNEXPECTED ERROR 32811 but when I go...
Ok so after a couple of days I am getting back to this again. I spent some time and this is the code I have so far:
Function nextnum(s As String) As String
Dim lastnum
lastnum = Split(Split(s, "(")(0), "")
nextnum = Format(CInt(lastnum(UBound(lastnum) - 1)) + 1, "0000")
Dim ofso, ofile...
Ok now with the added steps it becomes a little more clear. I will give it a try and get back with the results.
I sincerely am greatful for your help.
Tom
Why not simply use the Dir function to retrieve all the files of the day ?"
Answer:
The goal is to record the temperatures at specific times. I agree it would be much simpler to send one file with all the checks for the day. This is not what is desired by the QA department. Currently a lab...
Wow! That might take me some time to digest since I'm sure you can tell I am quite the novice when it comes to VBA.
I will do some experimentation and see what I can come up with.
Thank you
Tom
Skip,
First off thanks for responding. The file name is generated by a software application. The spaces are part of the file name and I can not do anything with them as far as I know.
Not sure if your suggestion is what I am looking for. The 0000 in my file name does not reference the hour...
Greetings all experts. I am having difficulty figuring out how to do this. I have an application that creates a file at certain times throughout the day. I am then using VBA to send the file to a list of recipients.
Here is the code I have so far:
Sub QC_TEMP_CHECKS_log_send()
Set App =...
I seriously apologize for not being able to figure this out. I copied and pasted your suggestions to my Excel macro so now it looks like this
Sub Modify_Count_Log()
'
' Modify_Count_Log Macro
Dim wb As Workbook
For Each wb In Workbooks
If wb.Name <> "Personal.XLSB" Then
wb.Activate...
Curious, have I done something wrong? Offended someone maybe? Wondering why I have not recieved any responses to my issue. If there is something I did wrong or need to do please let me know and I will correct it. If the solution to my problem above seems obvious to others can you explain...
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.