Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
macro to open a document
How do I write a macro to open a document? I tried to record a macro and go
this macro that selects a cell and follows a hyperlink. But I would like to put the address of the doc. into the macro and not have the hyperlink in a cell on the document. Sub OpenTemplate() Range("AH1").Select Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True ActiveWindow.ActivateNext End Sub Thanks, Todd |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
macro to open a document
Read the responses to Michelle Hanan's Opening doc in macro that was posted
on 7/12 "Todd" wrote in message ... How do I write a macro to open a document? I tried to record a macro and go this macro that selects a cell and follows a hyperlink. But I would like to put the address of the doc. into the macro and not have the hyperlink in a cell on the document. Sub OpenTemplate() Range("AH1").Select Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True ActiveWindow.ActivateNext End Sub Thanks, Todd |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
macro to open a document
Ok, Thanks.
From that I have this statement below. I am getting "a user defined type not defined error with the dim statement". I am looking at the library for excel types and don't know which one to choose? Thanks. Sub opendoc() Dim MyDoc As Excel.xls 'Set MyDoc = Excel.Documents.Open("C:\MyFiles\MyDoc.xls") End Sub "Penny Miller" wrote: Read the responses to Michelle Hanan's Opening doc in macro that was posted on 7/12 "Todd" wrote in message ... How do I write a macro to open a document? I tried to record a macro and go this macro that selects a cell and follows a hyperlink. But I would like to put the address of the doc. into the macro and not have the hyperlink in a cell on the document. Sub OpenTemplate() Range("AH1").Select Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True ActiveWindow.ActivateNext End Sub Thanks, Todd |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
macro to open a document
Try this;
Dim appWord As Object Dim myDoc As Object Set appWord = CreateObject("Word.Application") Set myDoc = appWord.Documents.Open("C:\MyFiles\MyDoc.xls") "Todd" wrote in message ... Ok, Thanks. From that I have this statement below. I am getting "a user defined type not defined error with the dim statement". I am looking at the library for excel types and don't know which one to choose? Thanks. Sub opendoc() Dim MyDoc As Excel.xls 'Set MyDoc = Excel.Documents.Open("C:\MyFiles\MyDoc.xls") End Sub "Penny Miller" wrote: Read the responses to Michelle Hanan's Opening doc in macro that was posted on 7/12 "Todd" wrote in message ... How do I write a macro to open a document? I tried to record a macro and go this macro that selects a cell and follows a hyperlink. But I would like to put the address of the doc. into the macro and not have the hyperlink in a cell on the document. Sub OpenTemplate() Range("AH1").Select Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True ActiveWindow.ActivateNext End Sub Thanks, Todd |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
macro to open a document
Thanks! This is closer. I am sorry that I don't know more and can just fix
it. This opens a my excel file as a word doc. How do I get it to open it in excel? I tried replacing the text "word" with "excel" but as I am sure you know, it didn't work. Thanks again, Todd "Penny Miller" wrote: Try this; Dim appWord As Object Dim myDoc As Object Set appWord = CreateObject("Word.Application") Set myDoc = appWord.Documents.Open("C:\MyFiles\MyDoc.xls") "Todd" wrote in message ... Ok, Thanks. From that I have this statement below. I am getting "a user defined type not defined error with the dim statement". I am looking at the library for excel types and don't know which one to choose? Thanks. Sub opendoc() Dim MyDoc As Excel.xls 'Set MyDoc = Excel.Documents.Open("C:\MyFiles\MyDoc.xls") End Sub "Penny Miller" wrote: Read the responses to Michelle Hanan's Opening doc in macro that was posted on 7/12 "Todd" wrote in message ... How do I write a macro to open a document? I tried to record a macro and go this macro that selects a cell and follows a hyperlink. But I would like to put the address of the doc. into the macro and not have the hyperlink in a cell on the document. Sub OpenTemplate() Range("AH1").Select Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True ActiveWindow.ActivateNext End Sub Thanks, Todd |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
macro to open a document
I guess I must have misunderstood you, I thought you needed to open a
document not a workbook. Instead try this code; Sub OpenWorksheet() ' ' Opens Worksheet Macro ' Macro recorded 8/3/2006 ' Workbooks.Open Filename:="C:\MyFiles\MyWorksheet.xls" End Sub "Todd" wrote in message ... Thanks! This is closer. I am sorry that I don't know more and can just fix it. This opens a my excel file as a word doc. How do I get it to open it in excel? I tried replacing the text "word" with "excel" but as I am sure you know, it didn't work. Thanks again, Todd "Penny Miller" wrote: Try this; Dim appWord As Object Dim myDoc As Object Set appWord = CreateObject("Word.Application") Set myDoc = appWord.Documents.Open("C:\MyFiles\MyDoc.xls") "Todd" wrote in message ... Ok, Thanks. From that I have this statement below. I am getting "a user defined type not defined error with the dim statement". I am looking at the library for excel types and don't know which one to choose? Thanks. Sub opendoc() Dim MyDoc As Excel.xls 'Set MyDoc = Excel.Documents.Open("C:\MyFiles\MyDoc.xls") End Sub "Penny Miller" wrote: Read the responses to Michelle Hanan's Opening doc in macro that was posted on 7/12 "Todd" wrote in message ... How do I write a macro to open a document? I tried to record a macro and go this macro that selects a cell and follows a hyperlink. But I would like to put the address of the doc. into the macro and not have the hyperlink in a cell on the document. Sub OpenTemplate() Range("AH1").Select Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True ActiveWindow.ActivateNext End Sub Thanks, Todd |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
macro to open a document
That does it! Thank you so much for your patience.
Todd "Penny Miller" wrote: I guess I must have misunderstood you, I thought you needed to open a document not a workbook. Instead try this code; Sub OpenWorksheet() ' ' Opens Worksheet Macro ' Macro recorded 8/3/2006 ' Workbooks.Open Filename:="C:\MyFiles\MyWorksheet.xls" End Sub "Todd" wrote in message ... Thanks! This is closer. I am sorry that I don't know more and can just fix it. This opens a my excel file as a word doc. How do I get it to open it in excel? I tried replacing the text "word" with "excel" but as I am sure you know, it didn't work. Thanks again, Todd "Penny Miller" wrote: Try this; Dim appWord As Object Dim myDoc As Object Set appWord = CreateObject("Word.Application") Set myDoc = appWord.Documents.Open("C:\MyFiles\MyDoc.xls") "Todd" wrote in message ... Ok, Thanks. From that I have this statement below. I am getting "a user defined type not defined error with the dim statement". I am looking at the library for excel types and don't know which one to choose? Thanks. Sub opendoc() Dim MyDoc As Excel.xls 'Set MyDoc = Excel.Documents.Open("C:\MyFiles\MyDoc.xls") End Sub "Penny Miller" wrote: Read the responses to Michelle Hanan's Opening doc in macro that was posted on 7/12 "Todd" wrote in message ... How do I write a macro to open a document? I tried to record a macro and go this macro that selects a cell and follows a hyperlink. But I would like to put the address of the doc. into the macro and not have the hyperlink in a cell on the document. Sub OpenTemplate() Range("AH1").Select Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True ActiveWindow.ActivateNext End Sub Thanks, Todd |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Using a macro to open another document | Excel Discussion (Misc queries) | |||
Using a macro to open another document | Excel Discussion (Misc queries) | |||
Macro to open specific document | Excel Discussion (Misc queries) | |||
Run a macro always I open an Excel Document | Excel Programming | |||
macro and button to open a word document from within excel | Excel Programming |