I would like to use Excel & VBA to open a word document upon clicking a link in Excel, and save that word document based off of a cell value.
I have no issue opening a document; I'm having trouble linking the cell name to the file name on the active sheet.
Any help would be great! This is simple...I will be a ninja someday. But not this day
http://hotfile.com/dl/141254736/19a3162/1.11.2012_ExcelRequest.xlsm.html
My code:
Dim oWd As Word.Application, oWdoc As Word.Document
Dim NewFileName As String
'Workbooks("1.5.2012_ExcelRequest.xlsm").Activate
'NewFileName = wb.Sheets("Sheet1").Range("B4").Value & ".xlsm"
Set oWd = CreateObject("Word.Application")
Set oWdoc = oWd.Documents.Add
oWdoc.Sections(1).Range.Text = "I'll format this into a template"
oWdoc.SaveAs ("C:MyTest.doc")
oWdoc.Close
oWd.Quit
Set oWdoc = Nothing
Set oWd = Nothing
I have no issue opening a document; I'm having trouble linking the cell name to the file name on the active sheet.
Any help would be great! This is simple...I will be a ninja someday. But not this day
http://hotfile.com/dl/141254736/19a3162/1.11.2012_ExcelRequest.xlsm.html
My code:
Dim oWd As Word.Application, oWdoc As Word.Document
Dim NewFileName As String
'Workbooks("1.5.2012_ExcelRequest.xlsm").Activate
'NewFileName = wb.Sheets("Sheet1").Range("B4").Value & ".xlsm"
Set oWd = CreateObject("Word.Application")
Set oWdoc = oWd.Documents.Add
oWdoc.Sections(1).Range.Text = "I'll format this into a template"
oWdoc.SaveAs ("C:MyTest.doc")
oWdoc.Close
oWd.Quit
Set oWdoc = Nothing
Set oWd = Nothing