T
terje.eriksen
Hi,
I'm working on a workbook with the following functions.
It contains different kinds of form to fill out. When I press
commandbutton 1 I get a "serial" number from a sheet that contains
these and this is inserted in the form,
afterwards I've got a button to save this form as a pdf, to a
specified location and specified filename. The thing i'm stuck with
now is that i want a hyperlink in a sheet called "archive" this link
is goint to be to the previous saved pdf.
The code I'm using at the moment work fine, but when i press the
"save" button again, it writes over the old hyperlink. Så in other
words, i need to add the hyperlinks with some kind of ofset,
so the link will come one by one in a row. My code:
Sub printandsave()
myfilenumber = CStr(ActiveSheet.Range("E2"))
myfilename = "c:\test\SR-" + myfilenumber +
CStr(ActiveSheet.Range("F2")) + ".pdf"
MsgBox (myfilename)
Application.ActivePrinter = "Win2PDF på Ne00:"
ActiveWindow.SelectedSheets.PrintOut From:=1, To:=1, Copies:=1, _
ActivePrinter:="Win2PDF på Ne00:", Collate:=True,
PrToFilename:=myfilename
End Sub
Sub Archive
myfilenumber = CStr(ActiveSheet.Range("E2"))
myfilename = "c:\test\SR-" + myfilenumber +
CStr(ActiveSheet.Range("F2")) + ".pdf"
ActiveSheet.Hyperlinks.Add Anchor:=Worksheets("archive").Range
'somethings missing here("A1"), Address:=myfilename,
TextToDisplay:="SR-" + myfilenumber + CStr(ActiveSheet.Range("F2")) +
".pdf"
'End Sub
I'm working on a workbook with the following functions.
It contains different kinds of form to fill out. When I press
commandbutton 1 I get a "serial" number from a sheet that contains
these and this is inserted in the form,
afterwards I've got a button to save this form as a pdf, to a
specified location and specified filename. The thing i'm stuck with
now is that i want a hyperlink in a sheet called "archive" this link
is goint to be to the previous saved pdf.
The code I'm using at the moment work fine, but when i press the
"save" button again, it writes over the old hyperlink. Så in other
words, i need to add the hyperlinks with some kind of ofset,
so the link will come one by one in a row. My code:
Sub printandsave()
myfilenumber = CStr(ActiveSheet.Range("E2"))
myfilename = "c:\test\SR-" + myfilenumber +
CStr(ActiveSheet.Range("F2")) + ".pdf"
MsgBox (myfilename)
Application.ActivePrinter = "Win2PDF på Ne00:"
ActiveWindow.SelectedSheets.PrintOut From:=1, To:=1, Copies:=1, _
ActivePrinter:="Win2PDF på Ne00:", Collate:=True,
PrToFilename:=myfilename
End Sub
Sub Archive
myfilenumber = CStr(ActiveSheet.Range("E2"))
myfilename = "c:\test\SR-" + myfilenumber +
CStr(ActiveSheet.Range("F2")) + ".pdf"
ActiveSheet.Hyperlinks.Add Anchor:=Worksheets("archive").Range
'somethings missing here("A1"), Address:=myfilename,
TextToDisplay:="SR-" + myfilenumber + CStr(ActiveSheet.Range("F2")) +
".pdf"
'End Sub