excel - Formula entered in Cells by VBA gives 1004 -
i'm using code populate excel sheet field values (e.g. subject, sender, etc) outlook.msg files. outlook.msg files in same folder excel file.
it convenient if can make hyperlink these messages in excel file. want hyperlink 'dynamic' in such way if move whole folder (with outlook.msg files , excel workbook) antother location link still works.
i use code creating 'dynamic'hyperlinks: hyperlinkstring = "=hyperlink(mid(cell(""filename"");1;find(""["";cell(""filename""))-1))" & sname
where sname outlook.msg file name populate cells in loop with
worksheet("sheetname").cells(row, column).formula = hyperlinkstring
this gives me 1004 run-time error. when put additional space before "="sign " =hyperlink(mid etc... code runs , cells filled , when remove space manually hyperlink works charm. why not working directly , there way?
when using .formula
need use commas ,
instead semicolons ;
in formula (even if local separator semicolon):
hyperlinkstring = "=hyperlink(mid(cell(""filename""),1,find(""["",cell(""filename""))-1))" & sname worksheet("sheetname").cells(row, column).formula = hyperlinkstring
alternatively use .formulalocal
instead .formula
. in case should use local separator in formula (i.e. semicolon ;
):
hyperlinkstring = "=hyperlink(mid(cell(""filename"");1;find(""["";cell(""filename""))-1))" & sname worksheet("sheetname").cells(row, column).formulalocal = hyperlinkstring
Comments
Post a Comment