Using AppleScript to Launch Excel VBA Macro

Using MS Office 2004 and AppleScript 1.9.3. I want to use AppleScript in MS Entourage to kick off a VBA macro in Excel. But no luck.
To test things, I created an Excel file ("test.xls") with a one-line VBA macro named "test." It just puts up a dialog box with the message "success." I'm calling it from A.S as follows (per the AppleScript Dictionary for Excel 2004):
tell application "Microsoft Excel"
run VB macro "hard disk:users:xxx:desktop:test.xls!test"
end tell
I get two successive error messages:
1. 'test.xls' cannot be accessed. The file may be read-only or you may be trying to access a read-only location."
2. "Microsoft Excel got an error: "hard disk:users:xxx:desktop:test.xls!test" doesn't understand the run VB macro message."
"test" file permissions are -rw-r--r-- and it is sitting right on the desktop.
FWIW, I did not remove the old Office vX yet, but renamed old Excel "Microsoft ExcelOld". I read on some other site that this may cause problems.
This has been endlessly frustrating. HELP!!??
Steve

Hi Steve,
Have you tried dealing with the return value from your macro? If you are invoking the MsgBox function in your test macro, you may need to allow the return value from MsgBox to pass thru back to AS. Something like :
set MyRetCode to run VB macro "Macintosh HD:Users:xxx:Desktop:test.xls!test"
(Note unless you've changed the hard drive name to "hard drive", the default boot drive name will probably be "Macintosh HD". Case does matter here)
I also suspect you'll need to have Entourage up as well in the full case of running a macro in Entourage from Excel (or the other way around). Hence, the command ActivateMicrosoftApp in the Excel dictionary may also be useful.
Second, you can have a macro, in a startup template, in Entourage call a macro in a startup template in Excel to accomplish what you want without going into AppleScript at all. This latter, VB-only, method will require a "Reference", as it's called in VBA, to be added to the TemplateProject in Entourage that points to the Excel macro you want to fire off. The added benefit of this latter method is that you will have access to the full range of VBA commands/options, rather than the smaller dictionary available in AS.
Ed
PB G4   Mac OS X (10.2.x)  

Similar Messages

  • Copying Graphs and Pie Charts generated in Analysis View to Email item using Excel VBA Macro Code

    Hi
    I am currently working on an exce VBA macro code that would help me take snapshots of the Graphs and Pie charts generated in QC for a particular application and copy the same to an email item using excel VBA macro code.
    I was able to write the code to create an email item. But I have no clue of how i can take snapshot of the graphs in Analysis View using excel VBA
    Any help would be highly appreciated.
    Thanks in Advance
    Regards
    Amit

    useramit,
    You are in the consumer end products forum.  You will also want to ask your question over at the Enterprise Business Community.
    Click the plus sign (+) next to Discussion Boards to drop down all the options for servers, networking and any other professionally related problems.
    http://h30499.www3.hp.com/

  • Powershell Variable from Excel.VBA Macro

    Hi Guys!
    I don't know if what i'm asking you is achievable.
    I've learned how to pass variables/arguments from powershell to Excel/VBA Macro but i need to do the opposite thing.
    This is an example of what  i want:
    Powershell                                                                      
                       Excel/VBA Macro
    $Input=1   ---------------------------------------------------------------->   Sub Macro(input)
    $excel.Run("Macro",$Input)                                                              
      Output=input +6
    $output (Expected 7)   <----------------------------------------------------  return Output
    I don't know how to do this can you help me please?
    A

    Ok guys those are the script.
    Macro:
    Sub CreatePWD()
    Dim PWD As String
    Dim i As Integer
    Dim Max As Integer
    Dim F1 As Worksheet
    Set F1 = ThisWorkbook.Worksheets("Foglio1")
    Max = F1.Range("A1").Value
    For i = 1 To Max
    If Int((2 * Rnd) + 1) = 1 Then
    PWD = PWD & Chr(Int((90 - 65 + 1) * Rnd + 65))
    Else
    PWD = PWD & Int((9 - 0 + 1) * Rnd + 0)
    End If
    Next i
    MsgBox PWD
    End Sub
    Powershell:
    $Excel = New-Object -ComObject excel.application
    $Excel.visible=$false
    $Version = "C:\Users\Alberto Corona\Desktop\Cartel1.xlsm"
    $WorkBook= $Excel.workbooks.open($Version)
    $WorkSheet= $WorkBook.worksheets.item(1)
    $WorkSheet.cells.item(1,1)=5
    $Excel.Run("CreatePWD")
    $WorkBook.save()
    $WorkBook.close()
    $Excel.quit()
    The result of macro is like "52UT7" i want a variable in powershell called $PWD that contain the value of the macro. 
    Hope the problem is clear now.
    Thanks
    A

  • Call Transaction from Excel VBA macro and download ALV list object results

    I have a situation that must be very common u2013 but I canu2019t find any clear information on how to get it done! 
    We frequently run SAP transactions, download the results (orders or inventory) into Excel, do some calculations and create a spreadsheet report. 
    I would like to automate this process using Excel VBA so that a macro will perform these steps:
    1. Run our custom SAP report "YSD033" that summarizes orders using the previous day as the [From Date] parameter.  (The user already has an active ECC 6 R3 session running.)   If possible, can the TC be run using a specific variant "G111BIZ" ?
    2. Download the list object that appears in an ALV grid as a table to an empty spreadsheet in the active workbook (export XXL list object)
    3. Save the resulting workbook and close Excel.
    Should the solution use u201Ccall transactionu201D or a GuiXT script?
    Any help would be much appreciated, and some sample VBA code would be great!
    Thanks.
    Glenn

    Good suggestion, but
    I get "permission denied" for   SapGuiAuto.GetScriptingEngine
    I also tried the method below, but received this RFC error message:
    User PPPPPPP  has no RFC authorization for function group SYST.
    Sub LoginCheck()
    If login = False Then
        ' Setting the necessary variables for R/3 connection
        Set objBAPICortrol = CreateObject("SAP.Functions")
        Set objConnection = objBAPICortrol.Connection
        ' Establish a connection
    If objConnection.Logon(0, False) Then
        login = True
        MsgBox "Connection Established"
        CommandButton1.Caption = "Disconnect"
    End If
    Else
        CommandButton1.Caption = "Connect 2 SAP"
        login = False
        objConnection.Logoff
        Set objConnection = Nothing
        Set objBAPICortrol = Nothing
    End If
    End Sub
    I was told that these kinds of authority open up too big of a window that can't be monitored adequately...
    I'm considering an approach like what is below if I can't convince security to grant me permissions...
        Application.Wait Now + TimeValue("00:00:01")
        SendKeys EnterKey, False
    Since blocked RFC security settings are preventing the solution from being installed, I am markgin this question as answered. 
    I will post different questions about 1. how to convince the security team that it will be safe to allow the use of RFC calls, and /or 2. how use some windows-level scripting code to run the SAP jobs.
    Thanks.
    Edited by: GlennWebster on Mar 1, 2010 4:34 PM

  • Using AppleScript to launch an application on a different machine

    Hi there,
    I'm trying to use AppleScript to enable a couple of my Macs to talk to each other.
    On one machine, I want to use this script:
    tell application "Finder" of machine "eppc://user:[email protected]"
    launch application "Rivet" of machine "eppc://user:[email protected]"
    end tell
    to have the other machine launch Rivet, a video server that I can access from the PS3/iPhone/iPad
    everything seems to work without issue (i.e. no errors), except it doesn't do anything.
    I see a line written to the console on "helium":
    9/23/10 18:48:30 com.apple.AEServer[3535] launchproxy[3535]: /System/Library/Frameworks/CoreServices.framework/Frameworks/AE.framework/Versi ons/A/Support/AEServer: Connection from: xxx:xxx:xxx:xxx:xxx:xxx%en0 on port: 60571
    every time I run the script on the other machine, but, like I said, nothing else happens.

    After much searching and trial and error I finally discoverd Hiroto's suggestion from way back in 2001. It is the only solution I have found that actually works to launch/activate any application on a remote Mac using an applescript on a local Mac.
    I have one Mac Mini running household control applications Indigo and iRed. I wanted to use embedded AppleScripts in those applications to launch and control PandoraBoy on another MacMini that I use as a media center. I discovered that you cannot activate an application on a remote Mac unless it's already running. (Only God and Apple know why!) And, of course, if you want to launch and application--it's usually NOT running!
    But the following works:
    set remoteMachine to "eppc://RemoteMachineName:[email protected]"
    tell application "Finder" of machine remoteMachine
    open ("/Applications/PandoraBoy.app" as POSIX file as alias)
    end tell
    THANK YOU HIROTO!!!
    Once the remote app is actually launched/activated you can then send AppleScript commands to it as follows:
    set remoteMachine to "eppc://RemoteMachineName:[email protected]"
    using terms from application "PandoraBoy"
    tell application "pandoraboy" of machine remoteMachine
    playpause
    end tell
    end using terms from
    I have also learned that the application to be controlled on the remote machine must also be present on the local machine and "using terms from" must also be used in the control script for this to work.

  • Using ms project 2007 and vba macro to list all the custom fields used in the project?

    Hi,Using ms project 2007 vba macro, I would like to be able to list all the custom fields used in the project and their corresponding field names. e.g. let us say I create a calculated duration field and name it "expected duration" and the name
    of the field I select is Duration1.
    I am trying to write a macro that will list all the used custom fields such as the result would look like:
    Duration1 ---> "expected duration"
    Text1       ---> "anything"
    Flag1        ---> "....."
    Number1  ---> "..............."
    Can anyone provide me with the solution?
    Regards,
    Chuck

    John,
    I found this module, which provides the the list of custom fields used in the project but does not provide the name given to the field. Here below is the module and hope you could help me achieve this by modifying the macro to list the renamed field.
    ' MSP Checks all Custom Task Fields
    Sub checkfields2()
    'This macro will check and report out which custom task fields are used
    'It requires Project 2002 and above as it relies on the GetField
    'and FieldNameToFieldConstant methods which were not introduced until
    '2002.
    'It does not include resource fields, however it is a simple matter to
    'do it by replacing the pjTask constant with pjResource.
    'Copyright Jack Dahlgren, Oct. 2004
    Dim mycheck As Boolean
    Dim myType, usedfields As String
    Dim t As Task
    Dim ts As Tasks
    Dim i, it As Integer
    Set ts = ActiveProject.Tasks
    usedfields = "Custom Fields used in this file" & vbCrLf
    myType = "Text"
    usedfields = usedfields & vbCrLf & "--" & UCase(myType) & "--" & vbCrLf
    For i = 1 To 30
    mycheck = False
    it = 0
    While Not mycheck And (it < ts.Count)
    it = it + 1
    If Not ts(it) Is Nothing Then
    If ts(it).GetField(FieldNameToFieldConstant(myType & i, pjtask)) <> "" Then
    usedfields = usedfields & myType & CStr(i) & vbCr
    mycheck = True
    End If
    End If
    Wend
    Next i
    myType = "Number"
    usedfields = usedfields & vbCrLf & "--" & UCase(myType) & "--" & vbCrLf
    For i = 1 To 20
    mycheck = False
    it = 0
    While Not mycheck And (it < ts.Count)
    it = it + 1
    If Not ts(it) Is Nothing Then
    If ts(it).GetField(FieldNameToFieldConstant(myType & i, pjtask)) <> 0 Then
    usedfields = usedfields & myType & CStr(i) & vbCr
    mycheck = True
    End If
    End If
    Wend
    Next i
    myType = "Duration"
    usedfields = usedfields & vbCrLf & "--" & UCase(myType) & "--" & vbCrLf
    For i = 1 To 10
    mycheck = False
    it = 0
    While Not mycheck And (it < ts.Count)
    it = it + 1
    If Not ts(it) Is Nothing Then
    If Left(ts(it).GetField(FieldNameToFieldConstant(myType & i, pjtask)), 2) <> "0 " Then
    usedfields = usedfields & myType & CStr(i) & vbCr
    mycheck = True
    End If
    End If
    Wend
    Next i
    myType = "Cost"
    usedfields = usedfields & vbCrLf & "--" & UCase(myType) & "--" & vbCrLf
    For i = 1 To 10
    mycheck = False
    it = 0
    While Not mycheck And (it < ts.Count)
    it = it + 1
    If Not ts(it) Is Nothing Then
    If ts(it).GetField(FieldNameToFieldConstant(myType & i, pjtask)) <> 0 Then
    usedfields = usedfields & myType & CStr(i) & vbCr
    mycheck = True
    End If
    End If
    Wend
    Next i
    myType = "Start"
    usedfields = usedfields & vbCrLf & "--" & UCase(myType) & "--" & vbCrLf
    For i = 1 To 10
    mycheck = False
    it = 0
    While Not mycheck And (it < ts.Count)
    it = it + 1
    If Not ts(it) Is Nothing Then
    If ts(it).GetField(FieldNameToFieldConstant(myType & i, pjtask)) <> "NA" Then
    usedfields = usedfields & myType & CStr(i) & vbCr
    mycheck = True
    End If
    End If
    Wend
    Next i
    myType = "Finish"
    usedfields = usedfields & vbCrLf & "--" & UCase(myType) & "--" & vbCrLf
    For i = 1 To 10
    mycheck = False
    it = 0
    While Not mycheck And (it < ts.Count)
    it = it + 1
    If Not ts(it) Is Nothing Then
    If ts(it).GetField(FieldNameToFieldConstant(myType & i, pjtask)) <> "NA" Then
    usedfields = usedfields & myType & CStr(i) & vbCr
    mycheck = True
    End If
    End If
    Wend
    Next i
    MsgBox usedfields
    End Sub
    This is what the module gives me. But I would like to have beside Text 1 the name that is shown as below. e.g Text1 is "Test".
    Would you mind helping me achieve this?
    Thanks in advance.
    Chuck

  • Excel-VBA Macro Connectivity to XE

    I have an excel-macro which accesses data from Oracle9i database with the connection code;
    Set oOraSession = CreateObject("OracleInProcServer.XOraSession")
    Set oOraDatabase = oOraSession.OpenDatabase("iois", "bacc/password", 0&)
    It runs smoothly with no problems. When I test the same application to my newly installed XE database, using the connection code;
    Set oOraSession = CreateObject("OracleInProcServer.XOraSession")
    Set oOraDatabase = oOraSession.OpenDatabase("XE.world", "bacc/password", 0&)
    it didnt run and broadcasts an error msg.;
    Runtime error '429'
    ActiveX component can't create object
    I know there's a way to solve this but how?
    Arnel

    Hi Arnel,
    you might try the easy connect syntax, works fine for me.
    Sub GetEmployees()
        ' Use OO4O
        Set objSession = CreateObject("OracleInProcServer.XOraSession")
        Set objDatabase = objSession.OpenDatabase("127.0.0.1:1521/XE", "hr/oracle1", 0)
        Sql = "select * from emp"
        Set oraDynaSet = objDatabase.DBCreateDynaset(Sql, 0)
        If oraDynaSet.RecordCount > 0 Then
            oraDynaSet.MoveFirst
            For x = 0 To oraDynaSet.Fields.Count - 1
                Cells(1, x + 1) = oraDynaSet.Fields(x).Name
                'Cells(1, x + 1).Format = Bold
            Next
            For y = 0 To oraDynaSet.RecordCount - 1
                For x = 0 To oraDynaSet.Fields.Count - 1
                    Cells(y + 2, x + 1) = oraDynaSet.Fields(x).Value
                Next
                oraDynaSet.MoveNext
            Next
        End If
        Set objSession = Nothing
        Set objDatabase = Nothing
    End SubRegards,
    ~Dietmar.

  • Excel VBA Macros - Hide/UnHide Cells

    I am tyring to create macro that will hide cells depending on what data is in the cell. I am currently using this and it is working but I want to be able to use 2 or more as I have different cells that I want hidden depending on what is entered into other
    cells.
    Private Sub Worksheet_Change(ByVal Target As Range)
        If Range("F5") = "Don't Show" Then
            Rows("8:9").EntireRow.Hidden = True
        Else
            Rows("8:9").EntireRow.Hidden = False
        End If
    End Sub
    But I also want this as well. How can I add them together?
    Private Sub Worksheet_Change(ByVal Target As Range)
        If Range("F9") = "Don't Show" Then
            Rows("8:9").EntireRow.Hidden = True
        Else
            Rows("8:9").EntireRow.Hidden = False
        End If
    End Sub
    Thanks

    Hi ALS91,
    Since this is a forum for Office client technical issue, not for technical issue in developing. I suggest you posting this issue in Excel for Developer.
    http://social.msdn.microsoft.com/Forums/office/en-US/home?forum=exceldev
    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you
    for your understanding.
    Best regards,
    Greta Ge
    TechNet Community Support
    It's recommended to download and install
    Configuration Analyzer Tool (OffCAT), which is developed by Microsoft Support teams. Once the tool is installed, you can run it at any time to scan for hundreds of known issues in Office
    programs.

  • Using AppleScript for launch a raw-query Spotlight search?

    As per usual with my limited scripting skills, I am finding the apparently simple stuff rather difficult to achieve.
    My problem with Spotlight is that I want to use the same type of raw query repeatedly, but I want to avoid the tedium of having to:
    1) open my saved search
    2) choose "Show Criteria" to make the saved raw query visible
    3) edit the text field containing the raw query, where the visible stuff is not what I want to edit, so I have to scroll to the right within that tiny field
    So my idea would be to design a simple UI with AppleScript that
    1) pops up a dialog asking for a phrase to search
    2) launches a Spotlight search using the raw query:
    kMDItemTextContent=="xxx*"
    where "xxx" is the phrase that I am searching for, and opens a Finder window with the results of that search.
    My reason for wanting to do this is that, by default, a search for an exact phrase with Spotlight fails to return matches that contain the plural form when the searched phrase is a singular.
    See:
    http://www.betalogue.com/2010/05/07/spotlight-plural/
    http://www.betalogue.com/2010/05/11/spotlight-phrase/
    for more information about the background for this.
    Would this be relatively easy to do with AppleScript?
    Thanks in advance.
    Pierre

    Hi
    Pierre Igot wrote:
    Am I correct in assuming that this means that what I wanted could not just be achieved with AppleScript and required a Perl script?
    Message was edited by: Pierre Igot
    A smart folder is an XML file (PLIST), you can edit it in many ways.
    It's possible with other shell commands (sed or awk).
    But perl works seamlessly with extended characters (ASCII > 127)
    Also it's possible with AppleScript commands (open for access, read, write, close access), or with *property list file* in System events
    But it requires more lines of code.
    Here's the script :
    global a_text
    set smartFolder to "/Users/jack/Library/Saved Searches/Recherche dans “Bureau”.savedSearch"
    set a_text to text returned of (display dialog "Enter a phrase to search" default answer "")
    if a_text contains """ then
    set a_text to findAndReplace(""", "\"", a_text)
    end if
    tell application "System Events"
    set TheXML to property list file smartFolder
    repeat with i in (get property list items of contents of TheXML)
    set t_name to name of i
    if t_name is "RawQuery" then
    tell i to set value to my replace_text(get value)
    else if t_name is "SearchCriteria" then
    tell property list item 2 of property list item "displayValues" of property list item 1 of property list item "FXCriteriaSlices" of i to set value to my replace_text(get value)
    else if t_name is "RawQueryDict" then
    tell property list item "RawQuery" of i to set value to my replace_text(get value)
    end if
    end repeat
    end tell
    set smartFolder to ((POSIX file smartFolder) as alias)
    tell application "Finder"
    activate
    open smartFolder
    end tell
    on replace_text(t)
    set x to the offset of "kMDItemTextContent==" in t
    set L to length of t
    repeat with i from L to 1 by -1
    if character i of t = """ then
    set y to i
    exit repeat
    end if
    end repeat
    return (text 1 thru (x + 20) of t) & a_text & (text y thru -1 of t)
    end replace_text
    on findAndReplace(tofind, toreplace, t)
    set ditd to text item delimiters
    set text item delimiters to tofind
    set t to text items of t
    set text item delimiters to toreplace
    set t to t as string
    set text item delimiters to ditd
    return t
    end findAndReplace

  • How to use loop in VBAK table using BDC RFC connection through excel vba ?

    Hello,
    I am trying to extract data from VBAK table using rfc connection with Excel VBA. where i can able to pull data first time, when i tried to use the same set of code using loops, it throws an error like BAD INDEX.
    Any help appreciated.

    Hello,
    I am trying to extract data from VBAK table using rfc connection with Excel VBA. where i can able to pull data first time, when i tried to use the same set of code using loops, it throws an error like BAD INDEX.
    Any help appreciated.

  • Problem with controlling Annotations from Excel VBA

    Hi,
    I have a PDF document that has plenty of sticky notes attached to it. These sticky notes have been added by multiple authors on all pages of the document. I am trying to import the contents of these sticky notes, their author and the page number to an excel spreadsheet.  I am using Excel 2007 and Acrobat Professional 9.0.
    This is the code that I am currently using to import the sticky notes, but the problem that I am facing is that when I run the macro -
    Same sticky note contents, author and page numbers are imported multiple times
    Not all sticky notes are imported, only some of them appear in the final excel spreadsheet
    When I compare the number of sticky notes to that in the original PDF file, the number is correct. But the content is repeated content and that is the reason why only some of the sticky notes are imported.
    This is an activity that I need to do on regular basis and the number of sticky notes that I need to import to excel may range between 100 to 200. It is really difficult to do this task manually, so an excel VBA macro could prove really helpful.
    Sub ImportComments_Click()
    Dim Fpath As String
    Dim WordObj As Object
    Dim wbkOutput As Excel.Workbook
    Dim iRow As Integer
    Dim i, j, k As Integer
    Dim lRet As Long
    Dim objAcroAVDoc As New Acrobat.acroAVDoc
    Dim objAcroPDDoc As Acrobat.AcroPDDoc
    Dim numPages As Long
    Dim lAnnotscnt As Long
    Dim Subtype As String
    Dim NumComments As Long
    Dim AcroApp As Acrobat.AcroApp
    Dim objAcroPDPage As Acrobat.AcroPDPage
    Dim annot As Acrobat.AcroPDAnnot
    Sheets("Defect Log").Select
    Range("L3").Activate
    Fpath = ActiveCell.Value
    Sheets("Defect Log").Select
    Range("A1").Activate
    i = 0
    Do While (Not (IsEmpty(ActiveCell.Value)) Or Not (IsEmpty(ActiveCell.Offset(0, 1).Value)) Or Not (IsEmpty(ActiveCell.Offset(0, 2).Value)) Or Not (IsEmpty(ActiveCell.Offset(0, 3).Value)) Or Not (IsEmpty(ActiveCell.Offset(0, 4).Value)) Or Not (IsEmpty(ActiveCell.Offset(0, 5).Value)) Or Not (IsEmpty(ActiveCell.Offset(0, 6).Value)) Or Not (IsEmpty(ActiveCell.Offset(0, 7).Value)) Or Not (IsEmpty(ActiveCell.Offset(0, 8).Value)) Or Not (IsEmpty(ActiveCell.Offset(0, 9).Value)) Or Not (IsEmpty(ActiveCell.Offset(0, 10).Value)) Or Not (IsEmpty(ActiveCell.Offset(0, 11).Value)) Or Not (IsEmpty(ActiveCell.Offset(0, 12).Value)) Or Not (IsEmpty(ActiveCell.Offset(0, 13).Value)) Or Not (IsEmpty(ActiveCell.Offset(0, 14).Value)))
    i = i + 1
    ActiveCell.Offset(1, 0).Select
    Loop
    iRow = i + 1
    Set wbkOutput = ActiveWorkbook
    lRet = objAcroAVDoc.Open(Fpath, "")
    Set objAcroPDDoc = objAcroAVDoc.GetPDDoc
    numPages = objAcroPDDoc.GetNumPages()
    Set objAcroPDPage = objAcroPDDoc.AcquirePage(0)
    For k = 1 To numPages
    lAnnotscnt = objAcroPDPage.GetNumAnnots()
    For m = 0 To lAnnotscnt - 1
    If lAnnotscnt = 0 Then Exit For
    Set objAcroPDAnnot = objAcroPDPage.GetAnnot(m)
    If (objAcroPDAnnot.GetContents <> "" And objAcroPDAnnot.GetSubtype = "Text") Then
    Cells(iRow, 5).Value = k
    Cells(iRow, 2).Value = objAcroPDAnnot.GetContents()
    Cells(iRow, 11).Value = objAcroPDAnnot.GetTitle()
    iRow = iRow + 1
    End If
    Next m
    Set objAcroPDPage = objAcroPDDoc.AcquirePage(k)
    Next k
    lRet = objAcroAVDoc.Close(1)
    Set objAcroAVDoc = Nothing
    Set objAcroPDAnnot = Nothing
    Set objAcroPDPage = Nothing
    Set objAcroPDDoc = Nothing
    End Sub

    Make sure you are current with 9.x patches, just on general principles.
    The code seems fine – nothing jumping out at me.
    You can also look at using the JSObject methods and trying this via the JavaScript stuff – that will give you more access to the Annotation information…
    From: Adobe Forums <[email protected]<mailto:[email protected]>>
    Reply-To: "[email protected]<mailto:[email protected]>" <[email protected]<mailto:[email protected]>>
    Date: Thu, 24 Nov 2011 04:25:12 -0800
    To: Leonard Rosenthol <[email protected]<mailto:[email protected]>>
    Subject: Problem with controlling Annotations from Excel VBA
    Problem with controlling Annotations from Excel VBA
    created by apreeti<http://forums.adobe.com/people/apreeti> in Acrobat SDK - View the full discussion<http://forums.adobe.com/message/4044740#4044740

  • Use Applescript to have Quicktime record audio

    I need to record and store an audio file of approximately 20 minutes in length in Filemaker Pro 13. I thought I could use Applescript to Launch Quicktime to do the recording, then tell Quicktime what folder to store it in as an MP3 file. I can't seem to understand the Quicktime dictionary to figure out how to do this.

    Thank You. I figured out what I needed to do. I did however also start playing around with applescript and seeing how one can read messages using applescript. Every example that I saw used the "get selection" term after the "tell application 'mail' " command. I guess that is supposed to get every message in the mailbox. When I tried it, all I got was an empty array. It didn't matter if I had a mailbox selected or a message selected. It also didn't matter if it was a new message or one that was already read. Is there supposed to be another command before the get selection? Seeing how this command seems to be in several examples that I have seen on the internet, I have to assume that it should work but it isn't working for me.

  • EventHandler Error while using AppleScript

    hi,
    I use AppleScript to launch Acrobat and run a preflight. Running this a script creates an "Not specfied EvnetHandler Error".
    I guess it come from resolving the filename and path. May somebody nows the "way" to define the preflight profile directly in the script.
    on run this_file
    try
    process_item(this_file)
    end try
    end run
    -- this sub-routine processes files
    on process_item(this_item)
    try
    tell application "Finder"
    set myPath to path to me
    end tell
    with timeout of 1 second
    tell application "Adobe Acrobat Pro"
    activate
    delay 1
    «event PRFLPRFL» this_item given «class PATH»:myPath
    end tell
    end timeout
    end try
    end process_item

    user10310678 wrote:
    I am using beta version. Oracle VM Manager 2.2.0If you have a beta version of 2.2, then you should be an Oracle employee. Please ask this question on an internal mailing list. If you are not an Oracle employee, please ask the employee that gave you this beta. As this is a beta, some functionality may not be operational yet, so I can't answer why this particular feature seems not to work.

  • TS4513 For me it is no more possible to use AppleScript in MainStage since 3.0.2 !!! Suggestions ?

    Hello,
    In the 3.0.1 version of MainStage, i used AppleScript to launch some actions.
    In 3.0.2 if i launch any AppleScript from MainStage, the program bug.
    Any suggestions ?
    Thank's !

    Yes, on MainStage 3.0.2, when I associate any applescript to a button (Actions->AppleScript->...) and I turn it, i have this bug : the mixer freezes and when I pass a patch to another, the strips are no longer updated. I have to restart MainStage to restore normal behavior ...

  • Using Excel VBA to Print to PDF File?

    Hi, All !!
    I have an Excel VBA application that creates Excel reports.  These need to be sent external to our company in PDF format.  I've downloaded the Acrobat SDK and have found the VB sample for AdobePDFSilent.  Unfortunately, it appears that this is written for VB or VB.Net as I don't have any of the data types available that are created in the code.  However, from another forum, I've gotten some VB code that appears to do many of the processes included in the SDK sample.
    The code below doesn't give me any errors, but no PDF file is created.
    My VBA code
    Declare Function RegOpenKeyA Lib "advapi32.dll" ( _
        ByVal Key As Long, _
        ByVal SubKey As String, _
        NewKey As Long) As Long
    Declare Function RegSetValueEx Lib "advapi32.dll" Alias "RegSetValueExA" ( _
        ByVal hKey As Long, _
        ByVal lpValueName As String, _
        ByVal Reserved As Long, _
        ByVal dwType As Long, _
        lpData As Any, _
        ByVal cbData As Long) As Long
    Declare Function RegCloseKey Lib "advapi32.dll" ( _
        ByVal hKey As Long) As Long
    Sub TestPrintPDF()
        Dim strDefaultPrinter As String
        Dim strOutFile As String
        Dim lngRegResult As Long
        Dim lngResult As Long
        Dim dhcHKeyCurrentUser As Long
        Dim PDFPath As String
        Const dhcRegSz As Long = 1
    1    Workbooks.Open ("\\master\fnshares\bcbcm\Client Management\Client Services\New Account Fees\09 September 2010\3Q10 Rebate Ltrs\Infi\MacroTest\A02.xls")
    2    Select Case ActiveWorkbook.Sheets.Count
    3        Case 1
    4            Sheets(1).Select
    5        Case 2
    6            Sheets(Array(Sheets(1).Name, Sheets(2).Name)).Select
    7        Case 3
    8            Sheets(Array(Sheets(1).Name, Sheets(2).Name, Sheets(3).Name)).Select
    9        Case 4
    10            Sheets(Array(Sheets(1).Name, Sheets(2).Name, Sheets(3).Name, Sheets(4).Name)).Select
    11        Case 5
    12           Sheets(Array(Sheets(1).Name, Sheets(2).Name, Sheets(3).Name, Sheets(4).Name, Sheets(5).Name)).Select
    13      Case 6
    14         Sheets(Array(Sheets(1).Name, Sheets(2).Name, Sheets(3).Name, Sheets(4).Name, Sheets(5).Name, Sheets(6).Name)).Select
    15  End Select
    16  dhcHKeyCurrentUser = &H80000001
    17  strDefaultPrinter = Application.ActivePrinter
    18  PDFPath = ActiveWorkbook.Path & Application.PathSeparator 'The directory in which you want to save the file
    19  strOutFile = PDFPath & Left(ActiveWorkbook.Name, Len(ActiveWorkbook.Name) - 4) & ".pdf" 'Change the pdf file name if required. This should have the fully qualified path
    20  lngRegResult = RegOpenKeyA(dhcHKeyCurrentUser, "Software\Adobe\Acrobat Distiller\PrinterJobControl", lngResult)
    21  lngRegResult = RegSetValueEx(lngResult, Application.Path & "\Excel.exe", 0&, dhcRegSz, ByVal strOutFile, Len(strOutFile))
    22  lngRegResult = RegCloseKey(lngResult)
    23  ThisWorkbook.ActiveSheet.PrintOut copies:=1, ActivePrinter:="Adobe PDF"
    24  Application.ActivePrinter = strDefaultPrinter
    25  ActiveWorkbook.Close False
    End Sub
    From what I can determine, the lines 17 & 24 combined basically accomplish the same thing as the SaveandUpdateDefaultPrinter function in the SDK (get and save the current default printer and return it to that default after printing the PDF).
    Line 20 opens the Registry key for Distiller\PrinterJobControl which is done in part of the ConvertFile function in the following SDK code.
    SDK Code
                Dim objDistillerRegKey As Microsoft.Win32.RegistryKey = Microsoft.Win32.Registry.ClassesRoot
                Dim strDistillerSubKey As String = "SOFTWARE\\Adobe\\Acrobat Distiller\\PrinterJobControl"
                'Open Current User's Distiller Subkey for writing
                objDistillerRegKey = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(strDistillerSubKey, True)
    Line 21 sets the Registry key for Excel with the name of the PDF file to output which also appears to be done in part of the ConvertFile function in the following code.
    SDK Code
               If (Not objDistillerRegKey Is Nothing) Then     'set reg key value for this app and file
                    objDistillerRegKey.SetValue(strAppPath, strOutputFile)
                    objDistillerRegKey.Close()
                End If
    I have verified, using RegEdit, that this Registry key does get set with the desired output filename.
    Line 23 prints the Excel file to PDF when done manually (this was recorded using the Excel Macro Recorder).  This should be comparable to the PrintToAdobePDF function in the SDK as below.
    SDK Code
        Private Sub PrintToAdobePDF(ByVal InputfilePath As String)
            'Prints InputFilePath to the AdobePDF printer.
            'Since we just gathered all this info programmatically,
            'this function assumes the file is present, that it has an
            'associated application and that the current user has print privileges.
            'Define properties for the print process
            Dim pProcInfo As New ProcessStartInfo
            pProcInfo.FileName = InputfilePath
            pProcInfo.Verb = "Print"
            'Make process invisible
            pProcInfo.CreateNoWindow = True
            pProcInfo.WindowStyle = ProcessWindowStyle.Hidden
            'start print process
            Dim pMyProc As Process = Process.Start(pProcInfo)
            pMyProc.WaitForExit()
        End Sub
    These are some of the statements I can't do because I don't have a ProcessStartInfo type.  What am I doing wrong or NOT doing that the PDF file is not created?  I hope I've described my situation in enough, but not too much detail.  Thanks for your help.
    Nate Brei

    Reinhard & Karl Heinz,
    Thank you both for your responses and willingness to work with me on this problem.  This is driving me crazy & is getting very frustrating.  It seems that I've tried everything that people have suggested (I've also posted on a VB Forum that I subscribe to) and I'm basically doing what works for everyone else but doesn't work for me.  I've got to be close.
    Reinhard, regarding your last post, it doesn't appear to be a one-time setting.  Everytime I come into the Printers Property box (even after I've printed a PDF document manually, that option about system & document fonts is ALWAYS turned on.  If it is a registry setting, please let me know how to turn it off.  I'm using Adobe Acrobat 9 Standard.
    Karl Heinz, I've tried that based on my initial post (see the code there).  Since your post, I tried it again.  I get the same result, NO FILE is produced anywhere.
    I wish I could post pictures, but evidently I can't.  So, I going to post first my code (in case you want to try to recreate my problem), then the values of the variables in that code when I run it (so you can I have everything set correctly as far as I know), and finally, the values of the Registry entries that I have after I run it.  So, please bear with me as the post may be a little long.
    My Code
    Declare Function RegOpenKeyA Lib "advapi32.dll" ( _
        ByVal Key As Long, _
        ByVal SubKey As String, _
        NewKey As Long) As Long
    Declare Function RegSetValueEx Lib "advapi32.dll" Alias "RegSetValueExA" ( _
        ByVal hKey As Long, _
        ByVal lpValueName As String, _
        ByVal Reserved As Long, _
        ByVal dwType As Long, _
        lpData As Any, _
        ByVal cbData As Long) As Long
    Declare Function RegCloseKey Lib "advapi32.dll" ( _
        ByVal hKey As Long) As Long
    Sub TestPrintPDF()
        Dim strDefaultPrinter As String
        Dim strOutFile As String
        Dim lngRegResult As Long
        Dim lngResult As Long
        Dim dhcHKeyCurrentUser As Long
        Dim PDFPath As String
        Const dhcRegSz As Long = 1
        'Workbooks.Open ("\\master\fnshares\bcbcm\Client Management\Client Services\New Account Fees\09 September 2010\3Q10 Rebate Ltrs\Infi\MacroTest\A02.xls")
        Workbooks.Open ("H:\A02.xls")
        Select Case ActiveWorkbook.Sheets.Count
            Case 1
                Sheets(1).Select
            Case 2
                Sheets(Array(Sheets(1).Name, Sheets(2).Name)).Select
            Case 3
                Sheets(Array(Sheets(1).Name, Sheets(2).Name, Sheets(3).Name)).Select
            Case 4
                Sheets(Array(Sheets(1).Name, Sheets(2).Name, Sheets(3).Name, _
                 Sheets(4).Name)).Select
            Case 5
                Sheets(Array(Sheets(1).Name, Sheets(2).Name, Sheets(3).Name, _
                 Sheets(4).Name, Sheets(5).Name)).Select
            Case 6
                Sheets(Array(Sheets(1).Name, Sheets(2).Name, Sheets(3).Name, _
                 Sheets(4).Name, Sheets(5).Name, Sheets(6).Name)).Select
        End Select
        dhcHKeyCurrentUser = &H80000001
        strDefaultPrinter = Application.ActivePrinter
        'The directory in which you want to save the file
        PDFPath = ActiveWorkbook.Path & Application.PathSeparator
        'Change the pdf file name if required. This should have the fully qualified path
        strOutFile = PDFPath & Left(ActiveWorkbook.Name, Len(ActiveWorkbook.Name) - 4) & ".pdf"
        lngRegResult = RegOpenKeyA(dhcHKeyCurrentUser, "Software\Adobe\Acrobat Distiller\PrinterJobControl", _
            lngResult)
        lngRegResult = RegSetValueEx(lngResult, Application.Path & "\Excel.exe", 0&, dhcRegSz, _
            ByVal strOutFile, Len(strOutFile))
        lngRegResult = RegCloseKey(lngResult)
        ThisWorkbook.ActiveSheet.PrintOut copies:=1, ActivePrinter:="Adobe PDF"
        'ThisWorkbook.ActiveSheet.PrintOut copies:=1, preview:=False, ActivePrinter:="Adobe PDF", _
            printtofile:=True, collate:=True, prtofilename:=strOutFile
        'Call printToPdf(strOutFile)
        Application.ActivePrinter = strDefaultPrinter
        ActiveWorkbook.Close False
    End Sub
    Sub printToPdf(PDFFilename)
        ' Define a postscript file name
        PSFileName = "H:\TempPostScript.ps"
        ' Print the Excel range to the postscript file
        'Dim MySheet As Worksheet
        'Set MySheet = ActiveSheet
        ActiveWindow.SelectedSheets.PrintOut copies:=1, preview:=False, ActivePrinter:="Adobe PDF", _
            printtofile:=True, collate:=True, prtofilename:=PSFileName
        ' Convert the postscript file to .pdf
        Set myPDF = CreateObject("PdfDistiller.PdfDistiller.1")
        myPDF.FileToPDF PSFileName, PDFFilename, ""
    End Sub
    Values of my Variables When I Run the Code
    ? dhcHKeyCurrentUser
         -2147483647
    ? strDefaultPrinter
         \\tcps01p\FNT12W00 Canon 5020 PCL 5e on Ne04:
    ? PDFPath
         H:\
    ? strOutFile
         H:\A02.pdf
    ? lngResult
         2280
    ? Application.Path & "\Excel.exe
         C:\Program Files\Microsoft Office\OFFICE11\Excel.exe
    ? dhcRegSz
         1
    ? Len(strOutFile)
         10
    ? PSFileName
         H:\TempPostScript.ps
    ? PDFFilename
         H:\A02.pdf
    Values of my Registry Entries (HKEY_CURRENT_USER\Software\Adobe\Acrobat Distiller\PrinterJobControl)
    (Default)          REG_SZ          (value not set)
    C:\Program Files\Microsoft Office\OFFICE11\Excel.exe          REG_SZ          H:\A02.pdf
    LastPdfPortFolder - EXCEL.EXE          REG_SZ          "Q:\Client Management\Client Services\New Account Fees\09 September 2010\3Q10 Rebate Ltrs\Infi\MacroTest
    Note:  There are a couple of other entries for documents that I've printed manually that I didn't include.  Also, the last entry above, contains the value of the folder that I last manually "printed" to.
    I've also noticed that I have a Registry SubKey under PrinterJobControl called DownloadFonts.  However, the only entry there is:
         (Default) REG_SZ (value not set)
    Is this the registry key you mentioned, Reinhard?
    As you can see in my code, I have 3 different methods that I've tried to print.  The first one defaults everything after selecting the Acrobat PDF printer.  The second sets the output filename as a PDF (basically what you suggested, Karl Heinz).  The third method calls a procedure that prints to a PostScript file & then uses Distiller to print from that file to pdf.  This is the method Reinhard suggested.
    With the first 2 methods, I get NO error messages, but no file(s) show up.  With the 3 method, I get the error about the Fonts checkbox, but it creates a 0K PostScript file.  When I skip that statement and run the other 2 statements, I get a log file that says the PostScript file is empty and not PDF file was created.
    YIKES...  What's going on?  Thanks again for attempting to help me!!!
    Nate

Maybe you are looking for

  • Confirmation of goods with "Approved" Status

    Hi All, We are at SRM7.0 and working on extended classic. After performing confirmation of goods receipt in SRM, the status is still showing as "approved" and not "posted in backend". Kindly let us know how to reprocess these confirmations in SRM sys

  • Family Sharing - How does child receive msgs & email?

    I added my 8 year old son to my Family Sharing.  I want to send him emails and iMessages from my iPhone to my iPad which he uses frequently.  When I attempt to send him a message from my iPhone or Mac, using his @icloud email address, I get errors sa

  • Option in "right click menu" to create or combine a PDF is blank.  How to restore?

    I am using CS6 and have had it installed on this machine for about 2 years.  Several months ago I noticed that when right-clicking a file the options to create PDF files is blank but the space in the menu is there and if I click that placeholder, it

  • How to set user specific Layout for executing IW38/IW39  report.

    Dear Experts, We have 10 users seperatly, For executing IW38/39 transaction they have maintained seperate layouts for executing the reports. While saving layout they have saved the layout as 'user specific' Now some body has chage the settings. After

  • Why is the map content on a iPhone different from OS X 10.9

    Hi, I have a question regarding iOS Maps on an iPhone and Maps included in OS X 10.9. I viewed on both devices exactly the same area. But the contents of the maps were different. On iOS Maps on the iPhone some main streets were missing. These streets