G
Guest
i need to automate a process where a user will import different excel books
to access. the problem is that the first 2 columns need to be text, because
the user has alpha numeric data in those columns. currently, when importing
access thinks it is numeric and as a result i get conversion errors.
i tried this code but did not work, as i still got conversion errors.
'Set xlapp = CreateObject("excel.application")
'Set xlbookformatted = xlapp.workbooks.Open("g:\aaa_rmsco\fee schedule
updates\facility.xls", 3)
'Set xlsheet = xlbookformatted.worksheets("rate sheet")
'With xlapp
' .Visible = False
' .xlbookformatted.xlsheet.Columns("A").numberformat = "@"
' .xlbookformatted.Save
' .xlbookformatted.Close
' .Close
' .Visible = True
' End With
'Set xlapp = Nothing
'Set xlbookformatted = Nothing
however, when i generated an excel macro whereby i did a text to column, i
got success.
what i need to know is how i can take this text to column logic that came
from excel, and build in access vb. i do not have documentation that shows
how to build this logic.
here is the excel generated code
Columns("A:A").Select
Selection.TextToColumns Destination:=Range("A1"), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False,
Tab:=True, _
Semicolon:=False, Comma:=False, Space:=False, Other:=False,
FieldInfo _
:=Array(1, 2)
also is there a way, i can rename the tab on the excel sheet to be rate sheet.
all the books are labelled differently, and want to change that name to rate
sheet,
to follow the code above
thanks for your help
to access. the problem is that the first 2 columns need to be text, because
the user has alpha numeric data in those columns. currently, when importing
access thinks it is numeric and as a result i get conversion errors.
i tried this code but did not work, as i still got conversion errors.
'Set xlapp = CreateObject("excel.application")
'Set xlbookformatted = xlapp.workbooks.Open("g:\aaa_rmsco\fee schedule
updates\facility.xls", 3)
'Set xlsheet = xlbookformatted.worksheets("rate sheet")
'With xlapp
' .Visible = False
' .xlbookformatted.xlsheet.Columns("A").numberformat = "@"
' .xlbookformatted.Save
' .xlbookformatted.Close
' .Close
' .Visible = True
' End With
'Set xlapp = Nothing
'Set xlbookformatted = Nothing
however, when i generated an excel macro whereby i did a text to column, i
got success.
what i need to know is how i can take this text to column logic that came
from excel, and build in access vb. i do not have documentation that shows
how to build this logic.
here is the excel generated code
Columns("A:A").Select
Selection.TextToColumns Destination:=Range("A1"), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False,
Tab:=True, _
Semicolon:=False, Comma:=False, Space:=False, Other:=False,
FieldInfo _
:=Array(1, 2)
also is there a way, i can rename the tab on the excel sheet to be rate sheet.
all the books are labelled differently, and want to change that name to rate
sheet,
to follow the code above
thanks for your help