Results 1 to 8 of 8

Thread: vb6 with Office 2013

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2013
    Posts
    3

    vb6 with Office 2013

    I am relatively new to vb and I am trying to modify my company's complex (at least to me) vb applications. The one in particular that I am having troubles with, doesnt work well with Office 2013. I get an error saying the edit replace function is not available. What is happening at the time of the error: The data in the GUI is supposed to be copied into a Word template document.

    I think I found the code where this is happening:
    If MultipleReplaceFlag Then
    .EditReplace Find:=OldString$, Replace:=ReplaceString$, Wrap:=1, ReplaceAll:=True
    Else
    .EditReplace Find:=OldString$, Replace:=ReplaceString$, Wrap:=1, ReplaceOne:=True
    End If

    What can I do to get this program to work with Office 2013?

    **Note**
    I have tried updating to .NET but there are a few hundred errors minimum in each program. For me, the "help" given isn't much help so it is very slow going that route.

  2. #2
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: vb6 with Office 2013

    I get an error saying the edit replace function is not available.
    as your code does not show which object is trying to editreplace, i would assume it should be a range object of some sort, but hard to tell from the snippet supplied
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  3. #3
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    Re: vb6 with Office 2013

    Welcome to the forums itstaff

    Your thread's title says that you are automating Office with VB6. But the code that you gave looks like VBA. Could you please confirm which one are you using?

    I also see that you mentioned trying it form VB.Net. Given a choice between VB6 and VB.Net, I would encourage you to move to VB.Net as VB6 is obsolete. Based on your choice (VBA/VB6/VB.Net), we can offer you appropriate advice

    Also if possible can you post the complete code of that procedure?
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

  4. #4
    Frenzied Member
    Join Date
    Jan 2009
    Location
    Watch Window(Shift+f9)
    Posts
    1,879

    Re: vb6 with Office 2013

    please always write the code inside the Code tags.together with this please post the full code of the method .where you are playing with it
    Code:
    If MultipleReplaceFlag Then
    .EditReplace Find:=OldString$, Replace:=ReplaceString$, Wrap:=1, ReplaceAll:=True
    Else
    .EditReplace Find:=OldString$, Replace:=ReplaceString$, Wrap:=1, ReplaceOne:=True
    End If

  5. #5

    Thread Starter
    New Member
    Join Date
    Oct 2013
    Posts
    3

    Re: vb6 with Office 2013

    I apologize for the late response on my part. The programs were all written and compiled in VB6, and that is as much as I know. I don't know how I would tell if it is VBA or VB6.


    I am not sure how to put in code tags. I have inserted a link to a text document containing the code. This is not all the code attached to the form but it is (I believe) the only place the edit replace is performed. The application integrates with a multivalue database and the code attached is where it copies everything into the template.

    https://dl.dropboxusercontent.com/u/62987665/vb.txt

  6. #6
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: vb6 with Office 2013

    I don't know how I would tell if it is VBA or VB6.
    vba (visual basic for applications) is not compiled, it is an interface within some application, generally an office product, VB6 is a programming language, that will create compiled executables, office applications can be automated by vb6 executables

    [code] your code here [/code (requires closing bracket) will give a code box, seems hard to give an example without just making a code box, though i have seen it done
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  7. #7
    Frenzied Member
    Join Date
    Mar 2008
    Posts
    1,210

    Re: vb6 with Office 2013

    > I get an error saying the edit replace function is not available.
    >...the code that you gave looks like VBA

    EditReplace is a not a valid call in Word VBA and I suggest the macro may be written in WordBasic (which did include EditReplace). Word's VBA can however still apparently support WordBasic calls/ code via its WordBasic object; deets for that here http://msdn.microsoft.com/en-us/libr.../ff822917.aspx
    I fear you will find it hard to find much documentation on WordBasic or help in debugging the code; you could be lucky though...
    It may be good to see some more of your code so we can see the object to which .EditReplace belongs.

  8. #8

    Thread Starter
    New Member
    Join Date
    Oct 2013
    Posts
    3

    Re: vb6 with Office 2013

    Sorry for the long delay. It seems that you are correct Magic Ink. It looks like the object .EditReplace belongs to is MSWord. It was declared as an object at the very top of the code (not shown in my link).

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