Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sendkeys CTRL + H wordpad

Status
Not open for further replies.

drrocket5292

Technical User
Sep 6, 2005
73
US
I'm having a problem in which I'm saving an excel file as a tab delimited text file. In actuality, I'm combining all of the columns into 1 and putting a semicolon in between each column before I save it because I need my text file to be semicolon delimited but the only option in excel is to make it tab delimited. when i do this, any row in excel with a comma in it gets saved in the text file within a pair of quotation marks. For instance:

John Doe;1,205.30;ABC

is being saved in the text file as:

"John Doe;1,205.30;ABC"

The quotation marks are not in excel and only show up when I open the text file in wordpad or notepad. However, they are most definitely part of the text file which is being uploaded into a company database that spits out all of the records with quotes. So to get around this I'm trying to use a shell command to open the txt file in wordpad and then I'm trying to use the sendkeys command to send CTRL + H to wordpad so that I can replace all of the " with nothing. This works when I do it manually. However, i can't get the sendkeys command to bring up the replace dialog box. My code is:

sendkeys "^H", true

I tried debugging it by changing the ^ to a + to test if wordpad responds to sending the shift key and it does so it must be the CTRL key that it doesnt like.

Does anyone know why this doesn't work or of a workaround to my current problem? Thanks for the help.
 
Why not save as tab-delimited, then open the file into a TextStream and do a Replace, changing Chr$(9) to ";"

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Drive a Steam Roller
 
The quotes are excel way of identifying the field.

I think the best way is to read the Excel file from a VB program and create the semicolon file from it. Use ADO to do this real quick.

------------------------------------------
The faulty interface lies between the chair and the keyboard.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top