Results 1 to 3 of 3

Thread: Convert Excel 9.0 Macro to VB5 Code

  1. #1
    Guest

    Question

    I'm trying to convert an Excel 2000(9.0) Macro into my VB5 project. The macro works perfectly, however, to deploy my program you get an .exe and a .xls. I don't like deploying my program with the ,xls, as it's easy to get into, and just sloppy.

    THe macro is quite long, I can e-mail or post it here if anyones interested in helping me otherwise I think I'll take it one step at a time. If anyone has a referance or a web site let me know.

    The part I'm working on now takes a .txt file & imports it into columns 1 & 2 starting at row 2 in Excel. First is my Excel Code second is what I have so far for VB. I think my VB part fails when it comes to the Arrays'

    Workbooks.OpenText _ File_Name:="C:\WINDOWS\TEMP\MP3_Export.txt",_
    Origin:=xlWindows, StartRow:=1, DataType:=xlDelimited, _ TextQualifier:=xlDoubleQuote, _ ConsecutiveDelimiter:=False,tab:=True, semicolon:=False, _
    comma:=False, Space:=False, Other:=True, OtherChar:="-", _ FieldInfo:=Array(Array(1, 2), Array(2, 2)))

    OPEN.TEXT("C:\WINDOWS\TEMP\MP3_Export.txt", _ file_origin:=2, start_row:=1,file_type:=1, _ text_qualifier:=3, consecutive_delim:=False, tab:=True, _
    semicolon:=False, comma:=False, Space:=False, Other:=True, other_char:="-", field_info:=Array(Array(1, 2), _
    Array(2, 2)))

    Sorry for the long post
    TIA

  2. #2
    Lively Member
    Join Date
    Jul 2000
    Location
    Sydney, Australia
    Posts
    74
    I'm not sure if this works in VB5 or not, sice I only have VB6 thats what I'll have to go on

    if you already have an excel macro, this is what you would do


    from VB5
    ( you will need to add a reference to the Excel objects in the project)


    Sub temp()
    Dim appXL As Excel.Application

    Set appXL = CreateObject("Excel.Application")

    With appXL
    ' put macro code in here
    ' precede each line of the macro with a "."

    .ActiveWorkbook.Save
    .Quit
    End With

    Set appXL = Nothing

    End Sub



  3. #3
    Guest

    Unhappy Doesn't work in VB5

    That code doesn't work with VB5, anybody have any other ideas?

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