<div>Shawn,</div>
<div>Thanks for sending the "simple" sample code for writing to a text file. However, I was looking for sample code for creating the type of station data file (binary) specifically suited for GrADS use. I was actually looking for an Excel VBA translation of the sample Fortran or C codes shown in the GrADS Users Guide. Sorry if my query wasn't clear enough.</div>
<div> </div>
<div>I do appreciate your response, and it should be a useful answer for related questions.</div>
<div> </div>
<div>Stephen McMillan</div>
<div>On Sun, May 2, 2010 at 11:21 AM, Shawn Delaney <span dir="ltr"><<a href="mailto:sd19surf@gmail.com">sd19surf@gmail.com</a>></span> wrote:<br></div>
<div class="gmail_quote">
<blockquote style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class="gmail_quote">Stephen,<br><br> Here's a simple write to text code I use for a readme file it also<br>has a loop that goes through group of cells. It's something you could<br>
modify.<br><br>///Start Code///<br>'Write the Initials to a Text file for the QA monitors to use<br> Const DELIMITER As String = "" 'Normally none<br> Const PAD As String = " " 'or other character<br>
Dim vFieldArray As Variant<br> Dim myRecord As Range<br> Dim nFileNum As Long<br> Dim i As Long<br> Dim sOut As String<br><br> 'vFieldArray contains field lengths, in characters, from field 1 to N<br>
vFieldArray = Array(20, 10)<br> nFileNum = FreeFile<br> Open qaLocation & "Initials_Key_Readme.txt" For Output As #nFileNum<br> Print #nFileNum, "**********************************"<br>
Print #nFileNum, "* The Initials Key for the QA *"<br> Print #nFileNum, "**********************************"<br> Print #nFileNum, ""<br> Print #nFileNum, "Name Initals"<br>
Print #nFileNum, ""<br> For Each myRecord In Workbooks(1).Worksheets("Master").Range("D7:D25")<br> With myRecord<br> For i = 0 To UBound(vFieldArray)<br> sOut = sOut & DELIMITER & Left(.Offset(0, i).Text & _<br>
String(vFieldArray(i), PAD), vFieldArray(i))<br> Next i<br> Print #nFileNum, Mid(sOut, Len(DELIMITER) + 1)<br> sOut = Empty<br> End With<br> Next myRecord<br>
Print #nFileNum, ""<br> Print #nFileNum, "* If your initials aren't what you normally use"<br> Print #nFileNum, "then you need to have the POC for your QA program"<br> Print #nFileNum, "change them in the master. Changes will not<br>
take effect"<br> Print #nFileNum, "until the next month!"<br> Print #nFileNum, ""<br> Print #nFileNum, "This initials file is vaild for the " &<br>qaDate & " Excel file"<br>
Close #nFileNum<br><br>///End Code///<br><br>Might not be the most professional of codes. Hope this helps get you started.<br><br>Shawn<br>
<div>
<div></div>
<div class="h5"><br>On 4/30/10, Stephen McMillan <<a href="mailto:smcmillan@planalytics.com">smcmillan@planalytics.com</a>> wrote:<br>> Does anyone have a "simple" example of an Excel VBA (macro) for creating a<br>
> station data file for use in GrADS? I have searched the User Archives but<br>> came up empty. I am familiar with the format instructions and the C and<br>> Fortran examples in the GrAD's Users Guide, but wish to use Excel to create<br>
> the file.<br>><br>> I could probably eventually translate from the Fortran example to VBA, but<br>> it would help if someone has already done that!<br>><br>> Stephen M<br>><br></div></div>
<div class="im">> ***************************************************<br>> The information contained in this e-mail message<br>> is intended only for the use of the recipient(s)<br>> named above and may contain information that is<br>
> privileged, confidential, and/or proprietary.<br>> If you are not the intended recipient, you may not<br>> review, copy or distribute this message. If you have<br>> received this communication in error, please notify<br>
> the sender immediately by e-mail, and delete the original message.<br>> ***************************************************<br>><br></div>_______________________________________________<br>gradsusr mailing list<br>
<a href="mailto:gradsusr@gradsusr.org">gradsusr@gradsusr.org</a><br><a href="http://gradsusr.org/mailman/listinfo/gradsusr" target="_blank">http://gradsusr.org/mailman/listinfo/gradsusr</a><br></blockquote></div><br>
<pre>***************************************************
The information contained in this e-mail message
is intended only for the use of the recipient(s)
named above and may contain information that is
privileged, confidential, and/or proprietary.
If you are not the intended recipient, you may not
review, copy or distribute this message. If you have
received this communication in error, please notify
the sender immediately by e-mail, and delete the original message.
***************************************************