Resolved How to edit excel file that include at the project

Tamiryosef

Active member
Joined
May 2, 2022
Messages
36
Programming Experience
1-3
Hello to all
I am new at visual basic.
I build windows form that get data and stored it on firebase.
Now I try to get the data the user enter also go to a invoice that I build on excel.
I added the excel invoice to my project resources library , the excel form is open.

How I can use the code to edit the excel form that add to the project?

I want to add the textbox that the user enter to be add to the excel form that open in my resource library?
Screenshot_20220502-212456_Gallery.jpg
 

Tamiryosef

Active member
Joined
May 2, 2022
Messages
36
Programming Experience
1-3
i try to run this and he say file exists

i remove the file form the folder and he still say file exists

module:
Module Module1

    Sub main()

        Dim filename As String = "C:\InventoryApp new\InventoryApp\InventoryApp\File\Excel\InvoiceTemplate.xlsm"
        If File.Exists(filename) Then
            Console.WriteLine("File exists")
        Else
            Console.WriteLine("File exists")
        End If




    End Sub
 

jmcilhinney

VB.NET Forum Moderator
Staff member
Joined
Aug 17, 2004
Messages
14,728
Location
Sydney, Australia
Programming Experience
10+
This is ridiculous. You're now hard-coding the wrong path instead of using Path.Combine to create the right path and you're displaying the same message whether the file exists or not. I can't do this any more.
 

Tamiryosef

Active member
Joined
May 2, 2022
Messages
36
Programming Experience
1-3
my mistake i fix the code to check if the file exists or not.
it and now it show me the file is not exists at the path that i check,but i see the file at my folder in my project

i fix the file name ,and now that i run the code he show my that file exists

but when i run the program he fail and give me error
 

Tamiryosef

Active member
Joined
May 2, 2022
Messages
36
Programming Experience
1-3
i do what you ask ,and you are correct the file not exists

i use this code to check but i don't understand if i see the file at my folder and my project why i don't
Moudel:
Module Module1

    Sub main()

        Dim filename = IO.Path.Combine(Application.StartupPath, "File\Excel\Invoice Template.xlsm")
        If File.Exists(filename) Then
            Console.WriteLine("File exists")
        Else
            Console.WriteLine("File not exists")
        End If




    End Sub


End Module
see it when it build the project

777.jpg
 

Tamiryosef

Active member
Joined
May 2, 2022
Messages
36
Programming Experience
1-3
ok i get it now it working ,OMG o_Oo_Oo_O
i need to chance the property of the file to this

build action to content
and
copy to output to copy always

thanks for you help sir :)


888.jpg
 
Top Bottom