+ Reply to Thread
Results 1 to 2 of 2

Copy something from excel to (excel or word) see which application i am opening

  1. #1
    Registered User
    Join Date
    10-27-2014
    Location
    HK
    MS-Off Ver
    MS Office 2010
    Posts
    2

    Copy something from excel to (excel or word) see which application i am opening

    Because my copy&paste function is being disabled, i would like to create a macro for me to copy&paste when i am using MS Excel and even MS Word.
    I try to store all the cells in a string array and then use assignment to paste. I think I can copy most cells in MS Excel.
    (Important) However, I don't know how to interact with MS Word file for this case.
    Also, to judge which application i would like to paste so i can paste accordingly.
    (Less Important) Or, even I can copy from MS Word to MS Excel.

    ***********************************
    Option Explicit

    Dim ntRow, ntCol As Integer
    Dim strCpy() As String

    Sub CpyRnge()
    ' CpyRnge Macro
    ' Keyboard Shortcut: Ctrl+Shift+C
    Erase strCpy()
    Dim i, j As Integer, rngChse As Range
    Set rngChse = Selection
    ntCol = rngChse.Columns.Count
    ntRow = rngChse.Rows.Count
    ReDim Preserve strCpy(ntRow, ntCol)
    For i = 1 To ntRow
    For j = 1 To ntCol
    strCpy(i, j) = rngChse(i, j)
    Cells(i, j) = strCpy(i, j)
    Next
    Next
    End Sub

    Sub PsteRnge()
    ' PsteRnge Macro
    ' Keyboard Shortcut: Ctrl+Shift+V
    Dim rngPste As Range
    Dim i, j As Integer
    Set rngPste = Selection
    For i = 1 To ntRow
    For j = 1 To ntCol
    If IsNumeric(strCpy(i, j)) Then
    Cells(rngPste.Row + i - 1, rngPste.Column + j - 1) = Val(strCpy(i, j))
    Else
    Cells(rngPste.Row + i - 1, rngPste.Column + j - 1) = strCpy(i, j)
    End If
    Next
    Next
    End Sub
    ********************************

  2. #2
    Registered User
    Join Date
    10-27-2014
    Location
    HK
    MS-Off Ver
    MS Office 2010
    Posts
    2

    Re: Copy something from excel to (excel or word) see which application i am opening

    can anyone help?

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Opening Excel Application before Opening Workbook
    By danny2000 in forum Access Tables & Databases
    Replies: 2
    Last Post: 05-27-2011, 07:02 AM
  2. [SOLVED] Opening excel spreadsheets via excel.application object w/o prompts
    By Andy S. in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 09-06-2005, 05:05 PM
  3. Opening excel spreadsheets via excel.application object w/o prompts
    By Andy S. in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 04:05 PM
  4. [SOLVED] Opening excel spreadsheets via excel.application object w/o prompts
    By Andy S. in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 10:05 AM
  5. [SOLVED] Opening excel spreadsheets via excel.application object w/o prompts
    By Andy S. in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 09-06-2005, 09:05 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1