Re: Wrong data format?
From: Peter Ostermann (peter-ostermann_at_t-online.de)
Date: 09/17/04
- Next message: Tom Ogilvy: "Re: VBA method to detect state of CAPSLOCK key?"
- Previous message: Tom Ogilvy: "Re: Using the addin solver inside a macro"
- In reply to: K Dales: "Re: Wrong data format?"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 17 Sep 2004 22:17:17 +0200
Hello K. Dales,
thanks a lot for engaging in the problem.
I your ideas will help me solving the task!
Regards
Peter
"K Dales" wrote:
> Hello Peter;
>
> As for the conversion ASCII to EBCDIC, I don't work with
> EBCDIC so not fluent with the character codes. If you
> search the knowledge base for "ASCII EBCDIC conversion"
> perhaps you may find some info or even a function you can
> use.
>
> If not, here is an idea: set up a work*** (hidden if
> desired - I will call it "ConvertCodes") that lists all
> the EBCDIC codes in column (A) set up such that the row
> number is the corresponding ASCII code (for example, the
> ASCII code 65 is for "A", so in cell A65 put whatever the
> numeric EBCDIC code for "A" is). Then you could set up an
> easy conversion formula:
>
> Public Function ConvertEBCDIC(ASCIIText As String) As
> String
>
> Dim Result As String, i As Integer, ECode As Byte
>
> Result = ""
>
> For i = 1 To Len(ASCIIText)
>
> ECode = Asc(Mid(ASCIIText, i, 1))
> Result = Result & Chr(Sheets("ConvertCodes").Range("A"
> & ECode))
>
> Next i
>
> ConvertEBCDIC = Result
>
> End Function
>
> As for the other question: If the user has copied with
> Ctrl-C, then the value is already stored in the clipboard
> and you don't have to do anything but use the SendKeys
> statement to do the Ctrl-V to paste (SendKeys "^V"). All
> this occurs just as if it was being typed manually.
>
> On the other hand, in my original reply I was suggesting a
> method that did not require the user to have to remember
> to enter the Ctrl-C. If you create a Command Button, you
> can have VBA read the cell contents when the button is
> pressed, store this value in a String variable, and then
> use it with SendKeys to enter it in the mainframe app.
> This will allow the user to automate the whole copy/paste
> process with the click of the button, e.g:
>
> Sub CommandButton1_Click()
> Dim CopyTxt as String
>
> CopyTxt = Range("InputCell").Value
> AppActivate "Mainframe"
>
> ' Use SendKeys here to do any necessary menus/navigation
> to prepare for input of data
>
> SendKeys CopyTxt
>
> End Sub
>
> The code samples are just basic outlines but hope they
> help.
>
> K Dales
>
> >-----Original Message-----
> >
> >"K Dales" wrote:
> >
> >> Create either a Worksheet_Change() event procedure or a
> CommandButton with
> >a
> >> _Click() event procedure that has code to do the
> following:
> >> a) read the cell value you need to convert
> >> b) apply the conversion routine (dependent on the
> coding scheme of the
> >> system you are pasting to. You may need to write a VBA
> function that
> >reads
> >> each character and applies the code translations).
> >
> >Hello K. Dales,
> >
> >I like to start decent. I will create a button that copies
> >the active cell into the "background", then converts it
> >into EBCDIC.
> >
> >After, I will position the curser manually into the right
> field
> >of the mainframe mask and then just "paste" there
> >using "CTRL - V"
> >
> >If that ever would work, then I would go ahead later.
> >
> >Can you help me with a code example just for the
> conversion to "EBCDIC "?
> >And say also , where the cell-content is stored, if it
> would have been just
> >copied by "CTRL - C"? How can I address this place by
> VBA for to
> >replace the content? Thanks.
> >
> >Best Regards
> >Peter Ostermann
> >
> >
> >
> >---
> >Outgoing mail is certified Virus Free.
> >Checked by AVG anti-virus system (http://www.grisoft.com).
> >Version: 6.0.744 / Virus Database: 496 - Release Date:
> 24.08.2004
> >
> >
> >.
> >
--- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.744 / Virus Database: 496 - Release Date: 24.08.2004
- Next message: Tom Ogilvy: "Re: VBA method to detect state of CAPSLOCK key?"
- Previous message: Tom Ogilvy: "Re: Using the addin solver inside a macro"
- In reply to: K Dales: "Re: Wrong data format?"
- Messages sorted by: [ date ] [ thread ]