Hi.
I got the following code to add data to my spreadsheet:
filepath="C:\Documents and Settings\got-john-sk\My Documents\@@TEMP\Macro test\Bevakningslista.xls"
Set ApplExcel = CreateObject("Excel.application")
Set wbExcel = ApplExcel.WorkBooks.open(filepath)
Set asheet = wbExcel.Sheets("Sheet1")
MkDir "C:\Documents and Settings\got-john-sk\My Documents\@@TEMP\Macro test\GOT" & file_no_str
asheet.cells(no_of_used_rows,1).value = Empl
asheet.cells(no_of_used_rows,2).value = File_station
asheet.cells(no_of_used_rows,3).value = file_no_str
With asheet
.Hyperlinks.Add Anchor:=.range(no_of_used_rows3),Address:="C:\Documents and Settings\got-john-sk\My Documents\@@TEMP\Macro test\GOT" & file_no_str,TextToDisplay:=file_no_str
end With
asheet.cells(no_of_used_rows,4).value = Shipper_Name_str
asheet.cells(no_of_used_rows,5).value = Consignee
asheet.cells(no_of_used_rows,6).value = Origin
asheet.cells(no_of_used_rows,7).value = Destination
asheet.cells(no_of_used_rows,8).value = delivery_terms
asheet.cells(no_of_used_rows,9).value = CFS
asheet.cells(no_of_used_rows,10).value = ETS
asheet.cells(no_of_used_rows,11).value = ETA
asheet.cells(no_of_used_rows,12).value = Vessel
asheet.cells(no_of_used_rows,13).value = Typ
asheet.cells(no_of_used_rows,17).value = MBL_number
asheet.cells(no_of_used_rows,20).value = "ny upplagd"
wbExcel.save
ApplExcel.Quit
I want the data in cell (no_of_used rows,3) to become a hyperlink to the folder with the same name as the string file_no_str, but trying to rip the code from a recorded excel macro I only get "object error".
Can someone pls assist, or do i need to add a second macro to the excel workbook?
I got the following code to add data to my spreadsheet:
filepath="C:\Documents and Settings\got-john-sk\My Documents\@@TEMP\Macro test\Bevakningslista.xls"
Set ApplExcel = CreateObject("Excel.application")
Set wbExcel = ApplExcel.WorkBooks.open(filepath)
Set asheet = wbExcel.Sheets("Sheet1")
MkDir "C:\Documents and Settings\got-john-sk\My Documents\@@TEMP\Macro test\GOT" & file_no_str
asheet.cells(no_of_used_rows,1).value = Empl
asheet.cells(no_of_used_rows,2).value = File_station
asheet.cells(no_of_used_rows,3).value = file_no_str
With asheet
.Hyperlinks.Add Anchor:=.range(no_of_used_rows3),Address:="C:\Documents and Settings\got-john-sk\My Documents\@@TEMP\Macro test\GOT" & file_no_str,TextToDisplay:=file_no_str
end With
asheet.cells(no_of_used_rows,4).value = Shipper_Name_str
asheet.cells(no_of_used_rows,5).value = Consignee
asheet.cells(no_of_used_rows,6).value = Origin
asheet.cells(no_of_used_rows,7).value = Destination
asheet.cells(no_of_used_rows,8).value = delivery_terms
asheet.cells(no_of_used_rows,9).value = CFS
asheet.cells(no_of_used_rows,10).value = ETS
asheet.cells(no_of_used_rows,11).value = ETA
asheet.cells(no_of_used_rows,12).value = Vessel
asheet.cells(no_of_used_rows,13).value = Typ
asheet.cells(no_of_used_rows,17).value = MBL_number
asheet.cells(no_of_used_rows,20).value = "ny upplagd"
wbExcel.save
ApplExcel.Quit
I want the data in cell (no_of_used rows,3) to become a hyperlink to the folder with the same name as the string file_no_str, but trying to rip the code from a recorded excel macro I only get "object error".
Can someone pls assist, or do i need to add a second macro to the excel workbook?