Hyperlink to open .dot with a macro

I have a word .dot that has a simple macro when opened, but when I try to 
open the .dot from a hyperlink the macro doesn't autostart.  Any ideas?
0
11/16/2005 10:11:32 PM
excel.misc 78881 articles. 5 followers. Follow

1 Replies
542 Views

Similar Articles

[PageSpeed] 1

I opened word and created a new test2.dot template file.

I put this code under the ThisDocument module:

Option Explicit
Private Sub Document_New()
    MsgBox "hi from new"
End Sub
Private Sub Document_Open()
    MsgBox "hi from open"
End Sub

I put a hyperlink in a cell in an excel worksheet that pointed to that test2.dot
file.

The Document_Open() event fired--but the actual template (test2.dot) opened--a
new document based on that template did NOT get created.

I think you may want to change your technique if you want a new document based
on that template to be created (and the Document_New event to fire).

I'd put a button on the worksheet that has a macro assigned to it.  It could
create a new document based on that template.

Option Explicit
Sub testme()
    
    Dim myCell As Range
    Dim WdApp As Object
    Dim testStr As String
    
    Set myCell = ActiveSheet.Range("d12") 'or whatever you want
    
    testStr = ""
    On Error Resume Next
    testStr = Dir(myCell.Value)
    On Error GoTo 0
    
    If testStr = "" Then
        MsgBox "Template file not found!"
        Exit Sub
    End If
    
    On Error Resume Next
    Set WdApp = GetObject(, "Word.Application")
    If Err.Number <> 0 Then
      Err.Clear
      Set WdApp = CreateObject("Word.Application")
    End If
    
    With WdApp
        .Visible = True
        .Documents.Add Template:=myCell.Value, _
            NewTemplate:=False, DocumentType:=0
    End With
    
    Set WdApp = Nothing

End Sub

scottEfraz wrote:
> 
> I have a word .dot that has a simple macro when opened, but when I try to
> open the .dot from a hyperlink the macro doesn't autostart.  Any ideas?

-- 

Dave Peterson
0
petersod (12004)
11/16/2005 11:07:36 PM
Reply:

Similar Artilces:

Edit a group of cells with a macro
I have imported data from another program which combines numeric and alpha characters into a single cell. I need to split the numeric data into one column and the alpha characters into an adjacent column. I copied the imported column into the adjacent column, then went to first column and created a macro which deletes the first 7 characters (the numeric values). When I run the macro on other cells it takes the information from the very first cell and keeps repeating it. What am I doing wrong? Hi! Can you post a few examples of the data you want to separate? Al -- Message posted from h...

Open vb application from outlook shared folder.
Hi, The application I intend to built will use a shared calendar to store appointments of multiple users. It needs to have an interface custom interface to add and remove appointments according to a set of business rules. I have been considering using vb. as an interface which users start from within outlook. Prefer to use vb rather than outlook forms. Need ideas on the way to present users with options for the vb app. Was considering using a html page set to the home page of a shared folder to display buttons for different app options. The issue from this approach is starting the vb app...

I want few website name for macro
Dear Friends..... i would like to study "macro " so if you know any good website fo it...please forward your feedback... Thanks irsath mohamme -- irsat ----------------------------------------------------------------------- irsath's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=3597 View this thread: http://www.excelforum.com/showthread.php?threadid=55764 "irsath" <irsath.2ab3mn_1151824203.8465@excelforum-nospam.com> wrote in message news:irsath.2ab3mn_1151824203.8465@excelforum-nospam.com... > i would like to study "ma...

Exchange 2003 transaction logs grow when opening ADO recordset
Hi all, I have an application performing an ADO select on a Exchange 2003 folder. Now this select causes the Exchange transaction log files to grow by approx. 2 MB. This does not happen if I run the application against a Exchange 2000 server. For additional informations please see my posting http://groups.google.com/groups?dq=&hl=en&lr=&ie=UTF-8&group=microsoft.public.exchange2000.development&safe=off&selm=91b29f39.0406160045.7b87952b%40posting.google.com Now my questions is whether this could rather be a Exchange (2003) configuration issues rather than a Exchange 200...

macro to find date format in a cell and delete that entire row
macro to find date format in a cell and delete that entire row i have dates in a column and date keeps changing, i want that if macro find date in a column , it deletes that entire row help me thank u so much everyone for ue hel -- Message posted from http://www.ExcelForum.com try Sub deletedate() For Each c In Selection If IsDate(c) Then c.EntireRow.Delete Next End Sub -- Don Guillett SalesAid Software donaldb@281.com "vikram >" <<vikram.15ix9t@excelforum-nospam.com> wrote in message news:vikram.15ix9t@excelforum-nospam.com... > macro to find date format in a ...

Macro to change X-axis scale has errors
I've read and studied code from a number of posts on this subject but my "newbie" macro code has errors. I have the minimumscale value and maximumscale value (entered by the user) stored in Sheet1 at $E$2 and $F$2. My chart is in Sheet2. This is my complete macro: Sub ChangeXAxisScale() ' ' ChangeXAxisScale Macro ' With Worksheets("Sheet2") With ActiveChart.Axes(1, 1) .MinimumScale = Range("$E$2").Value .MaximumScale = Range("$F$2").Value End With End With End Sub I know I am missing s...

Drop Down List / Open Report
How do I go about setting my Combo Box to open any one of my ten reports i.e.: rptCharge1.....................rptCharge10 Do I put there name in the Row Source Value [Value List] Row Source ;rptCharge1; What would have the Event OnClick Thanks for any Help....Bob On Sun, 12 Aug 2007 11:11:57 +1200, "Bob V" <rjvance@ihug.co.nz> wrote: > > >How do I go about setting my Combo Box to open any one of my ten reports >i.e.: rptCharge1.....................rptCharge10 >Do I put there name in the Row Source Value [Value List] >Row Source ;rptCharge1; >What wou...

Finding hyperlinks in a spreadsheet
I'm using Excel 2007 and have a spreadsheet of name, addresses, email address and URL's Some of the email and URL addresses are not formatted correctly so they don't generate as a hyperlinked value in a cell. Is there a way to sort or find all the cells that contain a hyperlinked value? Thanks On Fri, 17 Jul 2009 17:40:06 -0500, JDR - Hotmail wrote in microsoft.public.excel: >I'm using Excel 2007 and have a spreadsheet of name, addresses, email >address and URL's > >Some of the email and URL addresses are not formatted correctly so they >don'...

Multiple Hyperlinks in 1 cell?
I have some spreadsheets that have a column with some text (4 numbers) that link to a webpage, where the URL ends with the four numbers (eg.1234). Sometimes I place an additional 4-number reference to another Webpage in the same cell, so it looks like (eg.1234/5678). I have to get rid of the link since I only know how to set it for one Webpage or the other. Is there a way for users to click 1234 and go to that page, or click 5678 (in the same cell) and go to that selected page? Thanks! Not that I'm aware of. "davidemile" <davidemile@hotmail.com> wrote in message news:...

Opening Report Manager from anything besides localhost gives error
I've never noticed this before, but if I try to go to http:\\crmserver\ReportManager I get a 403.6 error: "Forbidden: IP address of the client has been rejected". However, http:\\localhost\ReportManager works when I'm on the server. My Crystal Reports SW works fine, and once I'm in Report Manager it appears to work fine. What did i do wrong? ...

Run macro on selected sheets
Hi I have a workbook with 103 sheets, I want a macro to run on 100 of the sheets. Here is the macro, can anyone help me with this? Sub ReconsileStockCard() Range("D3").Select ActiveCell.FormulaR1C1 = "=SUM(R[4]C[-2]:R[97]C[-2])" Range("D3").Copy Range("B7").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False Application.CutCopyMode = False Range("A7:A36,B8:B36").ClearContents Range("D3").ClearContents Range("D7").ClearContents...

Macro should not Run when Excel Sheet is Protected
Some of the defined Macros should not work when a Sheet is Protected and only the specific Users should have access Hi you could check in the macro if the sheet is protected. e.g. directly from the VBA help: If Worksheets("Sheet1").ProtectContents = True Then MsgBox "The contents of Sheet1 are protected." End If -- Regards Frank Kabel Frankfurt, Germany "Chakradhar" <Chakradhar@discussions.microsoft.com> schrieb im Newsbeitrag news:D0E7AA7C-1690-4DE5-B0BD-DF4C09413BEC@microsoft.com... > Some of the defined Macros should not work when a Sheet is ...

open form with no data
Hi, I have a form on which i present al lot of data from a database. On the form is a comobox which i use to select the right record en present the data of this record on the form. When i open de form, de combobox is empty (which is good !) but the rest of the form is already filled with the data of a record in the database (which is not good). When i choose a record for the combobox, the form is filled with the data of that particular record (which is good). So the only problem i have is on opening the form. Is it possible to open the form without it being filled with data...

Opening Publisher Files #4
I received an email with a Publisher 2003 Flyer attached. I have Pblisher 2000 and are not able to open the file. Is it possible? If so, how? Thanks!!! While waiting for decisions from his 6 university choices, Ed sees a message from Winnie <Winnie@discussions.microsoft.com>. On it is written: > I received an email with a Publisher 2003 Flyer attached. I have > Pblisher 2000 and are not able to open the file. Is it possible? Try asking the person who sent you the file to do a File > Save As... > Publisher 2000. -- Ed Bennett - MVP Microsoft Publisher http://ww...

Reg:Trying to write a macro in excel
Hi all, There are 3 sheets in a single xl file: Sheet 1: It contains the template to be populated with the information from the other sheets It contains only selected columns from sheet 2 and sheet 3 whose values need to be populated in sheet 1. PART 1: Sheet 3: contains 3rd column as "subproject id": and has different columns containing the subproject details Aim of code: 1. extract all the subproject ids into sheet1:from sheet 3 in the defined range of cells in sheet1 under the s...

Open Office and Windows 7 64-bit Compatibility
Is Open Office compatible with Windows 7 64-bit? Are there any special installation procedures one must follow, such as "run as administrator", install as Vista or Windows XP, etc.? As a long time user of Office 2000, what's the learning curve like in transitioning to Open Office? Any additional insights would be greatly appreciated. -- Thank You, Richard Open Office runs fine on Windows 7 x64. If you are an Office power user OO id probably not for you. For most people it is an excellent competitor to Microsoft Office. As it's free to try there's...

Opening a pst file with Outlook...
I sent home my contacts from outlook at work to my home here. The file is contacts.pst which is 761 KB. I went to outlook and clicked "file" "open" then "open data file" but my contacts are not showing. It brings me to a blank page. Does anyone know or have any idea where the contacts may have gone. I need these fiels ASAP as I am now working from home. If you can help please respond or call my cell at 630.532.1773 It would be greatly appreciated. Thanks, Shaun How did you create this PST? It's too small to contain much data. If you opened it and they...

Outlook 2007: Open email/RSS links in reading pane?
Hi all, is it possible to somehow tweak or install a third-party addin, or write my own, so that links open inside the reading pane? It will be really cool if I could read the whole RSS articles or open links others mail me without leaving Outlook. It _should_ be possible somehow... Thanks very very much in advance! Links, no. Attachments, possibly, once we get a previewer for HTML. -- Diane Poremsky [MVP - Outlook] Author, Teach Yourself Outlook 2003 in 24 Hours Need Help with Common Tasks? http://www.outlook-tips.net/beginner/ Outlook 2007: http://www.slipstick.com/outlook/ol2007/ ...

Formula / Macro Help
Hi, Can anyone help me? I have some text in cell A1 and i wish it to search in column A on other worksheets for that reference. If it then finds a match on one o the sheets i want it to tell me on sheet1 in B1 that its in worksheet 4 for example ie sheet1 A1 = Toy Car sheet4 A335 = Toy Car sheet1 B1 = Sheet4 Can this be done?? Any help appreciated Regards Crai -- BSLAUTOMATIO ----------------------------------------------------------------------- BSLAUTOMATION's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=761 View this thread: http://www.excelfo...

Error when opening certain Appointments
We just upgraded from CRM 1.2 to 3.0 and everything went smotthly except for one user, whenever we open appointments she created we get the "An error Has occured, Please contact you System Administrator" All her completed appointments are fine, phone calls e-mails all fine. Neither her nor anyone else can open those appointments but if we look into her Outlook Calendar, all the info is in there. She can make new appointments just fine, and can delete these old ones. No other users are experiancing this. Any ideas, are there log files that offer more detail to the error? ...

FYI: Open Word doc without unwanted messages
With the help of Doug Steele (thanks!) I was able to create a function to open Word docs more smoothly. Maybe it can be of use to someone else. See below for code and comments. Lars Function fOpenWordDoc(strFullPath As String) On Error GoTo Err_Handler 'Purpose: Open/BringToFront Word document without unwanted messages 'Comment: This function either opens a Word document or, ' if already opened by the user, brings it to front. ' Bringing it to front and not re-opening the Word ' document, prevents the default Word dial...

Files opening at start-up
I just got a new computer and was setting up defaults in Excel, and I mistakenly entered 'My Documents' in the Tools/Options/General field for "At startup, open all files in." So when I start Excel it tries to open EVERY file in My Domuments and I have to use Task Manager to kill it. I opened in Safe Mode to change that option, but that doesn't seem to work. (Ie, when I open Excel again in regular mode it goes back to opening every file.) Is there another way to fix this? THanks! Andrew Can you use Windows Explorer to rename that "my Documents" folder, then ...

Attachments don't open when opening them in OWA 2003 Public Folder
Hello, Our Exchnage 2003 and OWA working great. The only issue is when users or administrators try to open attachments that are stored in Public Folders through OWA they get "You are not authorized to view this page" HTTP Error 403 - Forbidden Does anybody know what could be the issue here and how can I fix it? Thanks. Could this be the problem? http://support.microsoft.com/kb/555001/en-us Nue "Sharapov" <Sharapov@discussions.microsoft.com> wrote in message news:60A8E836-3862-45B5-9BD2-F0F96F2D6EEF@microsoft.com... > Hello, > > Our Exchnage 2003 and...

Office 2000 (Delay to open Files)
Greetings, I'm having a challenge on a particular computer opening any office documents. If we double click the file to open it (network or local source) it shows the hour glass for what feels like hours - it may eventually open, sometime we give up. Now, if we open the application first (i.e.: Excel) then go to File-> Open and select any file it opens immediately. I've had this problem before, the only solution I could find at the time was wipe the machine and start over. I tried a repair or re-installation of Office, no change. Windows XP SP3 Office 2000 SP3...

How do you copy open PST files?
Does anyone know how you can copy an open PST file? You can't. -- Milly Staples [MVP - Outlook] Post all replies to the group to keep the discussion intact. <anonymous@discussions.microsoft.com> wrote in message news:627b01c42e52$5e5fd030$a401280a@phx.gbl... | Does anyone know how you can copy an open PST file? Milly - thanks for your response. OK, another question - is it possible to shut Outlook down via a command prompt? I.e. I'd like to setup a batch file to backup my PST files, but if I can't copy and open PST file, is it possible to shut down Outlook via a...