Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  HOME    TRACKER    Visual Basic

Copy & Paste Flexgrid Contents

hi,I am displaying records from an Access Database in a flexgrid. I was wondering if there was any way users can copy cells from the flexgrid and paste it somewhere in excel or elsewere. thanks

View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Cut And Paste Contents Of FlexGrid
I have a flexgrid that the user enters data into manually (it has 2 fixed rows). When an entry is made in the last row, I want to programatically cut the last 5 entries, clear the flexgrid and paste the last 5 entries at the start of the grid (starting at row 2). I tried a couple of different ways, but was not successful. Could someone point me in the right direction?

VB Code:
'At end - copy last 5 entries to the start of the grid                            startRow = .Rows - 5                            endRow = .Rows - 1                            startCol = 0                            endCol = .Cols - 1                            strData = ""                                For i = startRow To endRow                                    For j = startCol To endCol                                        strData = strData & .TextMatrix(i, j) & "  "                                    Next j                                strData = strData & vbCrLf                                Next i                             Clipboard.Clear                            'Clipboard.SetText (strData)                            .Clear                            .row = 2                            .col = 0                            .Clip = strData 'Clipboard.GetText(strData)  

Another question - is there now a different way to post code (looked at preview and the code is not formatted)?

MSFlexGrid Copy/paste Cell Contents?
I am using MSFlexGrids to display data from an array. I would like to be able to copy and paste contents of a cell to a text box, but I can't figure out how to make the right button on the mouse bring up the copy/paste menu. I can capture "pressing right mouse" button event, but can't get beyond this. I found an example program that automatically brings up this copy/paste menu, but I could find not code that made it happen. I checked all the properties for the MSFlexGrid they were using and matched them in my program, but still no copy/past menu. Can anyone help? thanks...TeeTime

Copy And Paste Entire Listbox Contents

Could someone please help me. I have set up cut copy and paste commands
in my program only problem is that it will only copy the item or last item I
How do I copy the Entire list.

Than You

Copy/Paste From Excel To Flexgrid ... Possible ?
If I want to pick up a number of cells (from the same column) in Excel and dump them in a flex, is it possible to copy and paste ?

Or am I asking too much ?

Copy N Paste In Flexgrid,urgent!!!
anybody have an idea on copy n paste more than one cell in the same msflexgrid? my project due by 31 of this month
pls post code,thanks.

Copy And Paste Rows Or Cells From Flexgrid To The Clipboard
How Can I use flexgrid to Copy and paste rows or cells from flexgrid to the clipboard.


Copy Paste / Copy To Cilp Board..
Is it possible to Copy and paste to a Picture Box?
Copy from a picture box to Clipboard. Or even save as a pcx or jpg/gif file?...


How Do I Get Macro To PASTE The Clipboard Contents?
I've been working on a macro for MS Word, so that if I key in a friends name at a prompt, it will go into a text file, find his name and address and paste it for me. I'm ALMOST there

The macro is below. The problem with it is this part:

  With Selection.Find
        .Text = "Michael Smith"

You see, instead of putting the text Michael Smith there, it has to paste the clipboard. So I am doing a find, and I want it to paste the clipboard text in the search field. How would I do that?

Selection.HomeKey Unit:=wdLine
    With Selection.Find
        .Text = "Friend:"
        .Replacement.Text = ""
        .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.MoveRight Unit:=wdCharacter, Count:=3
    Selection.EndKey Unit:=wdLine, Extend:=wdExtend
    ChangeFileOpenDirectory "C:"
    Documents.Open FileName:="address.txt", ConfirmConversions:=False, ReadOnly _
        :=False, AddToRecentFiles:=False, PasswordDocument:="", PasswordTemplate _
        :="", Revert:=False, WritePasswordDocument:="", WritePasswordTemplate:="" _
        , Format:=wdOpenFormatAuto, Encoding:=1252
    With Selection.Find
        .Text = "Michael Smith"
        .Replacement.Text = ""
        .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.MoveUp Unit:=wdLine, Count:=2
    Selection.HomeKey Unit:=wdLine
    Selection.MoveDown Unit:=wdLine, Count:=5, Extend:=wdExtend
    Selection.PasteAndFormat (wdPasteDefault)

Edited by - Scotsman on 6/4/2003 5:10:30 AM

Cut And Paste From Excel To Flexgrid In Vb
hi everyone.

i need to implement cut and paste from an excel
spreadsheet into an msflexgrid.

the user selects a range of cells from excel, then cuts/copies
and pastes it into an msflexgrid.

i would really appreciate any suggestions.


Copy And Paste
I am trying to copy a gif from windows explorer and pasting it into VBs Image Control and can't get it to paste. This is what I am trying.

Private Sub mnuMemPaste_Click()
Set frmMembers.Image1 = Clipboard.GetData
End Sub

and nothing is getting pasted
Image1 Control:
Drag Mode = Automatic
OLEDrag mode = Automatic
OLEDrop mode = Automatic

The user right clicks on the image control then a context menu popup with a choice copy or paste. Click the paste command sends you frmmain.mnumempaste.

I'm not sure if this is a VBA issue, but I thought I would give it try and see if anyone has run into the same issue.

We upgraded to Word 2000 this past June (we don't like to be trend setters) from Word95. Some of the users have problems going back and forth between documents when trying to copy and paste - their machines lock up.

Some of the lock-ups occur when the user is toggling between documents when they use the drop down Window, some are having the problem when they toggle between documents by clicking on the documents located on the bottom of their toolbar, and others have the problem when using Ctrl F6. It's not a universal problem.

Any thoughts? Thanks!

Unfortunately Copy/Paste in my workbook needs to be altered. When a user copies data, I need to validate that data and perform certian functions.

Originally I tried to just use "If cutCopyMode = 1 then..." but that doesn't seem to work the way I need it. Also, I would need to trap the enter key event(s) if the user was 'cuting' data to also perform these functions.

What I would like to know is if anyone else has had to replace / alter excel's cut/copy/paste logic and if there is anything I should be worried about.

I started writing procedures to capture 'OnKey' events as well as the menu driven events. But as I mentioned earlier, I need to also capture the enter key(s) event. If this is the only way to go, is there anything that should be going on if the user hit's the enter key(s) besides changing the offset?


I really need some help I'm on a deadline and I have to find a way to copy specific info from word and paste it in excel. I know what comes before and after the word or number I need does any one know how to do this.

I apoligize in advance this might be a double post but my previous post havent been really clear so I wanted to give a clear idea of what I want to do.

Copy And Paste
An Excel-document with 2 sheets, the first one is filled out like this:

Column A, Column B, etc.

Product A, 15kg, Red
Product B, 17kg, Blue
Product C, 20kg, Green

The second sheet is always empty when the document is opened.

You mark a productname, or several, and press a commandbutton, located on the first sheet, i want VB to copy the marked productnames and its info onto the second sheet, starting to fill it with info from the top.

I am new to VB so i would really appreciate specific code to get me started.
Thanks in advance.

Cut, Copy, And Paste
I Cant Seem 2 Get My Cut Copy And Paste Menu Buttons Working. Heres My Code:

Private Sub mnuCut_Click()
If rtbText.SelLength = 0 Then
rtbText.SelStart = 0
rtbText.SelLength = Len(rtbText.Text)
End If
Clipboard.SetText Screen.ActiveControl.SelText
Screen.ActiveControl.SelText = ""
End Sub

Private Sub mnuCopy_Click()
Clipboard.SetText Screen.ActiveControl.SelText
End Sub

Private Sub mnuPaste_Click()
SelText = Clipboard.GetText
End Sub

I have a MDI form and some MDI Childs forms.
I want to implement Cut/Copy/Paste in the program.
I want to know how can i retrieve the handle of the textbox that has the current focus in the program so that I can cut/copy/paste/select all ?

Copy And Paste
Hello! I hope this hasn't been disscussed before...if it has just send me the link and delete this post. (i haven't found such a thread tho')

I wanna' develop a VB application which has to take some information from a web page. I want this to be done by selecting the whole page (Ctrl+A) in the users browser then paste it into the program...when he pastes the page only certain areas of the text in the page need to be pasted into the available text boxes. (not necessarily text boxes...) I want these text areas to be selected automatically by the application without the user having to manually enter each information into each of the text boxes.

Got any ideea how to do this?

For example let's say the following is the text from the web page:

>>Phone Number: 40334421
>>Name: Will Smith
>>Comments: Actor

When I paste the whole text into the VB application i want only 40334421 to be pasted into the txtPhnNo textbox, the Will Smith pasted into the txtName textbox and Actor pasted into the txtCmnt text box.
I hope you undesrtand where I'm going with this.


P.S. I work with VB 6.0

Copy And Paste
I have created a simple program in visual basic that checks data entered to make sure its in a certain format. Is is possible for this program to be modified so that it can copy the data entered and paste it in anouther program for example notepad?

Copy And Paste
I am trying to implement the Copy and Paste functions. I got "the selecting the text" part done but I am having trouble pasting the text. That is, my question is how do we refer to the position the mouse is at. And since I am trying to do the paste on a text box how do I implement this ?

For example, I can't do something like Text1.Text = Text1.Text + Text1.SelText.

Any advice?

Copy > Paste
I Have two web browsers

Web Browser one displays just text
Web Browser two displays a text box

Is there any way that when I Copy the text in Web Browser one, it automaticlly pastes in web browser 2?


Vba Copy And Paste
I am selecting a range out of worksheet and copying it to another. the worksheet is saved with protection after the macro runs the workbook closes itself and when I reopen it the sheet is no longer protected. Why is it doing this and how can I stop it? I don't want to save the sheet with the macro because I do not want to save the new data on the sheet.

Copy/Paste Huh?
let say you have a macro that copys and paste stuff in a huge worksheet. takes 5 min to run.

while the macro is working you go on the web and ctrl-c an article from

when i press ctrl-v i get text from my worksheet instead of the article. While my excel sheet has my bbc article on it. WTH!

Copy And Paste
I want to prevent the user from copy and paste how do i do that using vb?

Copy And Paste
Hey everyone,
simple question. How do you make a listbox capable of Ctrl+C (copy)?
Also, along the same lines, how do you make it Ctrl+X (cut) and Ctrl+V (paste)

And one other thing. Is it possible to have a code/script/macro that can automatically take info from my program and enter it in to a web-site, say like E-bay. I'm trying to simplify some of my web browsing by having a program automatically enter username/password. Like I have a selection choice in my program for "Hotmail". When selected, I need it to take the settings from the "Hotmail" area and automatically prefill it into the Hotmail website for me. Is that even possible?

Thanks all!

Copy And Paste !!!!
I am new to VB , not completed anything that works as yet....
Mainly because i'm asking too much of myself....maybe the idea I have for my next one is too much also , could you give me a rating for the below ? Beginner , medium etc..

Project :

Be able to store all "copied" (with right mouse click) into one word document , so you can go back to earlier copies etc

Sound easy , But is it ?


Cut, Copy, Paste, Etc How Can U Do Them
hey, i was just trying to figure out how to add a button in vb that when pressed copies, cuts, pastes or watever with a bit of text

could someone help

Copy And Paste
hi i need ny program to copy a file like "new word.txt" to somewhere like "C:word documents" and call it's self "Text1.txt" insted of "New word.txt" i hope you know what i mean. so i want the program to get the file it has made and make a copy to "C:word doucumentsText 1.txt" ok it's not a save command but like a log book.

Cut, Copy And Paste

i know that using

clipboard.settext txtbox.seltext



will copy and paste text to and from clipboard and txtbox.

what can i do so that this will work for other textboxes?


i need a menu to be able to cut,copy,paste text in a textbox.......
how do i acomplish this?

Cut Copy Paste - Please...
I am still not quite sure of, nor do I understand the code for 'cut, copy, paste, and undo'. I have had lots of help from people, and lots of different code, but I still fail to get it to work.

I have menu items
All I really want them to do is cut, copy, paste, and undo. Is there some way that I can call "ctrl + X" when user clicks mnuCut?

I know this code is probably very simple, and I am making it difficult for myself, but is there anyone who can show me how to do this? It would be great.



How would I write the code for cut, copy and paste commands?

Would I just use seltext method somehow?



I have a menu on my application and I want to enable de paste menu only if there is something on the clipboard

how can I do this?????

A code will be really helpful

Copy & Paste
Ok..this may seem dumb..but I am fairly new to VB so i was wondering If anyone can tell me how to scipt COPY & PASTE on my menu bar.

I used Visual Studio to do the menu abr but now trying to get the buttons to work is becoming mroe difficult than anticipated...any help would be HIGHLY appreciated


Cut, Copy And Paste
i am making a notepad thing and i want to have cut, copy and paste in the menu. Apparently you cannot do this with the textbox i have because it does not support the sel argument. however if i right click the selection on the textbox, it cuts, copys and pastes the text. How would i simulate the right click -copy or paste etc in my code.

Copy And Paste
I need some help with copy and paste. I have a sstab that is loaded with labels ranoamly placed on the sstab at run time. Tabs are added when no more labels will fit. I need to know if i can copy and paste (or drag and drop)one the the labels from one tab to another tab.

Copy And Paste From One HD To Another
i would like to copy and paste a file from one hard drive to another using a program made in visual basic. i have used a driveListbox, a DirListBox and a FielListBox to show files from a selected directory.. can someone please tell me the code to copy and paste a fiel which is selected in the FileListBox.

Private Sub Dir1_Change()
File1.Path = Dir1.Path
End Sub

Private Sub Drive1_Change()
Dir1.Path = Drive1.Drive
End Sub

Private Sub File1_Click()
Copy File1.FileName
Paste File1.FileName
End Sub



Copy / Paste Exe Help.
Aight, this is what i need.

- I need a program ( Program1 ) to copy it's self when you press Command1.
- Then paste that copy in a folder called "Folder2" in program1's folder.
- Then make a text file in Folder2 named "Log.txt", and print "Complete" in the text file.

If this can be done, plz let me know.

Cut Copy Paste
how would i cut, opy or paste into a text box by clicking a button?

Cut, Copy And Paste
What is the syntax for cutting, copying and pasting from clipboard?


Copy And Paste...
how can i do this :

When i run the program it copy's another program from a path and paste into a path i tell him then colse this program and then run the program which i copied in to path

help plox!

Copy Paste
how possible create button for command copy , paste?

ctrl+C , ctrl+V ?


- Cut - Copy - Paste
hi there,
i'm making an application for game purpose, in which app. user r going to create map(hope some body there knows about map). basically map consists of a tiles in a grid of rows and columns, with layers functionality.
here i want to add a feature of CUT-COPY-PASTE, using this feature user will be able to cut part of map and paste it where ever desired(as normally cut-copy-paste functions).
here my problem is the map is not only a picture box, actually it acts as a container which holds several picture tiles in the grid of rows and columns. this grid is made up of using array of structure which holds the indexes picture tiles.

do any body have any idea how to do this.

plz help

thanx in advance

Copy & Paste
Hey, I am trying to get my app to copy selected text and paste it but it wont put it onto the clipboard, I searched on the net and this is what quite a lot of sites said to do

VB Code:
Private Sub mnuEditCopy_Click()Clipboard.SetText rtbMain.SelTextEnd Sub

Can someone tell me whats wrong with it

Copy And Paste ?
Accidently posted this in the VBA thread already, my bad.

Here is my code

VB Code:
Private Sub cmdCopy_Click()Dim copy as String'START COPY MACRO    With Session    'Starting point        .SetSelectionStartPos 8, 15    'Are to be copied        .ExtendSelectionRect 8, 22    'Copying selection        .CopySelection    'Set string equal to copied text or numbers        copy = "weee"    'Displaying copied text or numbers    MsgBox "You coppied " & copy    End With'END COPY MACROEnd Sub

Where it says copy = "weee" the desired effect I really want is copy = .copyselection, except just putting that in doesn't work. Can anyone offer some help ?

i need to copy, and paste files thru vb (just one text file at a time for now)
i know how to edit them, but not how to copy, can someone please post a source?or anything that will be of use..
remember im just taking a text file and copy/pasting it

Cut, Copy, Paste

If no text is selected in my textbox, I don't want the copy or cut functions to be available on my toolbar/menu. Likewise if the clipboard is empty I don't want to Paste to be available.

I'm thinking that on the keypress/mousemove/any activity events of my textbox I could put in the appropriate code to enable and disable the relevant options. But this seems a bit messy to me. Is this the correct way to go about doing this or does anyone know of a better way?


Someone knows how to copy to clipboard VB code from VB code window, and paste it with all attributs (having comments in colour, commands in other colour ...) exactly like VB presents code for us ....

Thanks in advance

Copy And Paste
I have a form with 15 text boxes and 6 combo boxes. I would like to know is there away to add code to my program that would copy all the data in each of the cells with a shortcut like ctrl-a to highlight all and ctrl-c to copy the data?

thanks in advance annie

No Copy & Paste
How can I disable "copy & paste" for a text control in VB for security control purpose?


Copyright 2005-08, All rights reserved