Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi all,
with some help (!) I managed to have a .doc file to open after running a macro with a given input in a cell. For instance: cell b2 hs the value 101 Now after selecting the cell (B2) and running the macro. The file 101_document will be opened. However: the "_document" part is a random name. My list of files looks a bit like this: 101_smith_retail 102_Johnson_hardware 103_Kelly_cycles How can I open a file after input? So the line: strFilename = "_document.doc" should be more like: strFilename = random_name ???? Sub test() 'Dim MyFile As String Dim wdapp As Object strFilename = "_document.doc" Set wdapp = CreateObject("Word.Application") With wdapp .Documents.Open Filename:="C:\" & ActiveCell.Value & strFilename .Visible = True End With Set wdapp = Nothing End Sub I hope my description is clear enough for you to understand what i'm looking for? Thanks in advance for your help, Theo -- Greetz, Just4fun |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
after opening existing spreadsheet can't input data anymore | Excel Worksheet Functions | |||
Opening a file with User Input | Excel Discussion (Misc queries) | |||
opening an excel file opens a duplicate file of the same file | Excel Discussion (Misc queries) | |||
Opening a template form & renaming it from a cell input automatica | Excel Discussion (Misc queries) | |||
Opening a text file for input | Excel Programming |