Adding data to a CSV file troubleshoot

concreteinterface

Board Regular
Joined
Jul 10, 2008
Messages
144
I have been over this a few times and can't figure it out. I have used this code a few times in the same project and it does work with similar setups. For some reason this sub is not working. Any suggestions?

Code:
Sub AddCompany()

Call Definitions.Definitions
Dim My_filenumber As Integer
Dim logSTR As String
Dim COL As String


    My_filenumber = FreeFile
    
    logSTR = InputBox("What is the name of the company?")
    COL = WOP & "\Company List.csv"
    Open COL For Append As #My_filenumber
        Print #My_filenumber, logSTR
    Close #My_filenumber


    MsgBox My_filenumber   '1
    MsgBox WOP             '\\IP Address\file\file\file  WOP is declared as a public function in the Definitions.Definitions Sub
    MsgBox COL             '\\IP Address\file\file\file\Company List.csv
    MsgBox logSTR          'Customer
    
    'Company List.csv is filled with 24 rows in 1 column
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
Wow. Fixed it myself. I actually fixed it a while ago but my CSV file must not have been updating. The fix was putting a comma after the input box string with commas after every existing entry in the CSV file. Here's the code.

Code:
Sub AddCompany()

Call Definitions.Definitions
Dim My_filenumber As Integer
Dim logSTR As String
Dim COL As String




    My_filenumber = FreeFile
    
    logSTR = InputBox("What is the name of the company?") & ","
    COL = WOP & "\Company List.csv"
    Open COL For Append As #My_filenumber
        Print #My_filenumber, logSTR
    Close #My_filenumber




    MsgBox My_filenumber   '1
    MsgBox WOP             '\\IP Address\file\file\file  WOP is declared as a public function in the Definitions.Definitions Sub
    MsgBox COL             '\\IP Address\file\file\file\Company List.csv
    MsgBox logSTR          'Customer,
    
    'Company List.csv is filled with 24 rows in 1 column
 
Upvote 0

Forum statistics

Threads
1,223,243
Messages
6,170,967
Members
452,371
Latest member
Frana

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top