Results 1 to 16 of 16

Thread: [RESOLVED] Is VB6 compatible with Office 2007?

  1. #1

    Thread Starter
    Fanatic Member esposito's Avatar
    Join Date
    Sep 2003
    Location
    Perugia, Italy
    Posts
    961

    Resolved [RESOLVED] Is VB6 compatible with Office 2007?

    Hello, I was wondering if VB5/6 is still compatible with the latest version of MS Office, i.e. Office 2007. In other words, I would like to know if it is still possible to reference Word or Excel using the late binding as we could do with Office XP or 2003.

    So, do you know if code like the one below (NB: it is only an example and it is incomplete) still works with Office 2007?

    VB Code:
    1. MyText = Trim(txtLetter.Text)
    2.     WApp.ActiveWindow.Selection.ParagraphFormat.Alignment = 1
    3.     WApp.ActiveWindow.Selection.InsertAfter MyText
    4.     WApp.ActiveWindow.Selection.InsertParagraphAfter
    5.     WApp.ActiveWindow.Selection.Font.Name = "Arial"
    6.     WApp.ActiveWindow.Selection.Font.Size = 10
    7.     WApp.ActiveWindow.Selection.Font.Bold = True
    8.     WApp.ActiveWindow.Selection.EndOf

    Thank you in advance.

  2. #2
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: Is VB6 compatible with Office 2007?

    I haven't tried it yet but until now new Office products didn't break compatibility with any of the previous releases. New look, expanded object hierarchy, new functionality... So, I hope it's still the case.
    I'm planning on testing it in few weeks.

  3. #3

    Thread Starter
    Fanatic Member esposito's Avatar
    Join Date
    Sep 2003
    Location
    Perugia, Italy
    Posts
    961

    Re: Is VB6 compatible with Office 2007?

    Quote Originally Posted by RhinoBull
    I haven't tried it yet but until now new Office products didn't break compatibility with any of the previous releases. New look, expanded object hierarchy, new functionality... So, I hope it's still the case.
    I'm planning on testing it in few weeks.
    Thanks. Let me know then.

  4. #4

  5. #5

  6. #6
    Member
    Join Date
    Jan 2007
    Posts
    51

    Re: Is VB6 compatible with Office 2007?

    is office 2007 free to download?

  7. #7

  8. #8

    Thread Starter
    Fanatic Member esposito's Avatar
    Join Date
    Sep 2003
    Location
    Perugia, Italy
    Posts
    961

    Re: Is VB6 compatible with Office 2007?

    Quote Originally Posted by RhinoBull
    Apparently there were some issues with the beta version but hopefully they are fixed by now.
    Good. If it is only a question of a few bugs, I am sure MS will sort them out.

    My concern was that MS could abandon VBA and prevent VB6 apps from interacting with Office 2007 to force developers to switch to .NET.
    Last edited by esposito; Feb 4th, 2007 at 02:46 AM.

  9. #9

  10. #10

  11. #11
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Is VB6 compatible with Office 2007?

    Yes, on a clean install of Office, even on Vista.

    One note though, I wouldnt use WApp.ActiveWindow.Selection for a couple of reasons.
    Its dependant upon the desired document being the active one (in cases when the word app has multiple documents opened in it).
    Slows down as its more resource intensive.

    Change it to something like...

    VB Code:
    1. WApp.Documents(1).Content.Font.Name = "Arial" 'Or use the document name instead of the index position
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  12. #12

    Thread Starter
    Fanatic Member esposito's Avatar
    Join Date
    Sep 2003
    Location
    Perugia, Italy
    Posts
    961

    Re: Is VB6 compatible with Office 2007?

    Quote Originally Posted by RobDog888
    Yes, on a clean install of Office, even on Vista.

    One note though, I wouldnt use WApp.ActiveWindow.Selection for a couple of reasons.
    Its dependant upon the desired document being the active one (in cases when the word app has multiple documents opened in it).
    Slows down as its more resource intensive.

    Change it to something like...

    VB Code:
    1. WApp.Documents(1).Content.Font.Name = "Arial" 'Or use the document name instead of the index position
    Thank you very much.
    Since I discovered Delphi and Lazarus, VB has become history to me.

  13. #13
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: [RESOLVED] Is VB6 compatible with Office 2007?

    There are new extensions too. So depending on your app's automation code you will still need to update your code. .docx is the 2007 equilivalent of .doc but for files without any macros/vba code. .docm is for macro enabled documents. .dotx and .dotm also as related to templates. Then add in all the original 97-2003 extensions/file types.

    Np, anytime.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  14. #14

    Thread Starter
    Fanatic Member esposito's Avatar
    Join Date
    Sep 2003
    Location
    Perugia, Italy
    Posts
    961

    Re: [RESOLVED] Is VB6 compatible with Office 2007?

    Quote Originally Posted by RobDog888
    There are new extensions too. So depending on your app's automation code you will still need to update your code. .docx is the 2007 equilivalent of .doc but for files without any macros/vba code. .docm is for macro enabled documents. .dotx and .dotm also as related to templates. Then add in all the original 97-2003 extensions/file types.

    Np, anytime.
    So, if I understand well, this means that if you want to work on an existing Word (or Excel) document or you want to save a new one, you can't target a .doc or .xls file.

    On the contrary, if you create a document on the fly, without saving it, the (pseudo)code below still works.

    VB Code:
    1. Dim WApp As Object
    2.     Dim WDoc As Object
    3.    
    4.     Set WApp = CreateObject("Word.Application")
    5.     Set WDoc = WApp.Documents.Add
    6.                        
    7.     'YOUR CODE GOES HERE
    8.  
    9.     WApp.Visible = True

    Please correct me if I am mistaken.
    Since I discovered Delphi and Lazarus, VB has become history to me.

  15. #15
    New Member WindFox's Avatar
    Join Date
    Jan 2005
    Location
    Somewhere in this blasted star system
    Posts
    11

    Re: Is VB6 compatible with Office 2007?

    I know this has already been settled but I just thought to post this for people.
    Office 2007 (like previous versions up to... I wanna say 2000?) come with VBA 6.5



  16. #16
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: [RESOLVED] Is VB6 compatible with Office 2007?

    Yes, it comes with VBA but its a little newer version.

    6.5.1020 vs. the older 6.3
    Attached Images Attached Images  
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

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