Results 1 to 2 of 2

Thread: problem with replace

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2003
    Posts
    1

    problem with replace

    Hi,
    Need some help.
    Writing a macro and trying to send information from a table in word to excel, It works yes, but from the word table it takes some strange character with it, so we had to use a replace command to get rid of those two characters that followed along.
    It works fine i excel but the replace command doesent seem to work in word, and there is the problem, is there anything else I can use to do the same thing as below
    Here is the code I use:

    Dim objApp As Object
    Dim objExcel As Object
    Dim mycell As Object

    Dim strCurrent As String
    Dim strReplaced As String
    Dim test As Integer
    Dim test2 As Integer


    Set mycell = ActiveDocument.Tables(1).Cell(Row:=1, Column:=1)
    Set objeApp = CreateObject("Excel.Application")
    Set objExcel = objeApp.Workbooks.Open("C:\Ky\Test\apa2.xls")

    test = Len(mycell)
    test2 = test - 1

    strReplaced = Application.WorkbooksFunction.Replace _
    (Arg1:=mycell, Arg2:=test2, _
    Arg3:=2, Arg4:="")

    objExcel.Worksheets("blad1").Range("A1").Value = mycell

    Thanks for all help

  2. #2
    Frenzied Member Spajeoly's Avatar
    Join Date
    Mar 2003
    Location
    Utah
    Posts
    1,068
    Your not telling it to remove a character, your telling it to remove an integer.

Posting Permissions

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



Click Here to Expand Forum to Full Width