using sendkeys in notepad?

Jofffox

Registered User.
Local time
Today, 06:50
Joined
Feb 26, 2008
Messages
12
I currently have a report that is produced into a new notepad file, which i then have to manually Select all then copy.

I was trying to use sendkeys to automatically transfer the report to the clipboard. but im strugling with the code. The comand to open the reprt is as follows:

DoCmd.OutputTo acOutputReport, "COA Data1", acFormatTXT, "qry1Txt.Txt", True

Sendkeys(^A^C)?? doesnt work :(

thanks

Jon
 
Where's the code to open the report? I see code to output the report to a text file, but that doesn't automatically open the file.

What are you trying to accomplish with the sendkeys? Are you trying to copy the contents of the file into the clipboard, or the file itself?
 
the aim of the report publishing in notepad is to produce a suituable format for data to be cut n pasted into an external programme. e.g:

Data entry form:
Name
Address;
Telephone:
Etc

(SUBMIT - containing the below code) No records are saved. Just published in notepad.

DoCmd.OutputTo acOutputReport, "COA Data1", acFormatTXT, "qry1Txt.Txt", True


A new notepad doc is opened (called query1Text.text) with the current Data entry form information included.

I then need to copy this report into the clipboard to send to the external system. Apparenly i can use sendkeys to perform the Cntl +a then Cntl +c??

Thanks in advance for your help.

Jon
 
I don't know if this helps as it is in Word. This is code I use but I have knocked all the middle out which is inserts to Bookmarks.

Const MSTB_MSWORD = 300&

Application.Run "utility.util_StartMSToolbarApp", MSTB_MSWORD

Dim docName As Object
Set docName = CreateObject("Word.Basic")

docName.FileOpen "c:\Letters\0AMPMike.doc"

docName.EditSelectAll
docName.EditCopy
docName.FilePrint
docName.FileClose (2)
 
the aim of the report publishing in notepad is to produce a suituable format for data to be cut n pasted into an external programme. e.g:

Data entry form:
Name
Address;
Telephone:
Etc

(SUBMIT - containing the below code) No records are saved. Just published in notepad.

DoCmd.OutputTo acOutputReport, "COA Data1", acFormatTXT, "qry1Txt.Txt", True


A new notepad doc is opened (called query1Text.text) with the current Data entry form information included.

I then need to copy this report into the clipboard to send to the external system. Apparenly i can use sendkeys to perform the Cntl +a then Cntl +c??

Thanks in advance for your help.

Jon

Sendkeys is notoriously unreliable. It requires you to have focus on whatever you are trying to copy, in this case you would need to have notepad opened and ensure that it has the focus before trying.

I would look at methods other than the clipboard to try and copy your data to where you need...however if the clipboard is your only option I'd look at using the SetClipboardData API as it is much more reliable than sendkeys.
 

Users who are viewing this thread

Back
Top Bottom