0

actually i have a very large code in excel vba. and it is really working very well. but when i m trying to use this code to vb.net then a part of this code is not working. i.e.

Dim fnum As Variant
Dim FileName As Variant
FileName = Application.GetSaveAsFilename(InitialFileName:="Voucher", FileFilter:="Text Files (*.xml),*.xml")
    If FileName = False Then
        ''''''''''''''''''''''''''
        ' user cancelled, get out
        ''''''''''''''''''''''''''
        End
        Exit Sub
    End If
    'Debug.Print "FileName: " & FileName, "Separator: " & Sep
    fname = CStr(FileName)

fnum = FreeFile

    Open fname For Output Access Write As #fnum
    Print #fnum, st

'EndMacro:
On Error GoTo 0
Close #fnum

Can any expert help me on this issue.........
Thanks in advance..

Regards
CA Mahaveer Somani

2
Contributors
2
Replies
15
Views
3 Years
Discussion Span
Last Post by ddanbe
0

In the above code line no. 17 there is one word "st"

it is Dim st As String

and st is not blank it gets some value before above part of the code.

Thanks in advance experts

0

I would change

Dim fnum As Variant
Dim FileName As Variant

into

Dim fnum As Integer
Dim FileName As String
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.