+ Reply to Thread
Results 1 to 4 of 4

VBA 64 bit Excel, difficulty opening a file

  1. #1
    Registered User
    Join Date
    04-12-2014
    Location
    Thailand
    MS-Off Ver
    Excel 2013
    Posts
    3

    VBA 64 bit Excel, difficulty opening a file

    I'm a beginner with VBA so please be gentle, and thanks to all the great contributors here that have helped me so far.

    I have a file called Output.glb

    If I click on the file in explorer it opens with it's default application without problem.

    Using the shell command I can only open the default application. (exe)

    A lot of reading suggests that this may be a 64 bit issue.

    Assuming that I can click the icon for the file in windows and it opens correctly in the default application - I must be able to do the same within VBA surely..

    I've tried - Shell "C:\theprogram.exe C:\thefile.glb", 1 but it only opens the theprogram.exe

    I've spent the day trying all sorts of code snippets found online (some quite complex) and it just refuses to work.. I believe its a 64 bit issue..

    Any advice would be appreciated.

    Thanks
    Last edited by londonwelsh; 08-30-2014 at 10:49 AM.

  2. #2
    Valued Forum Contributor fredlo2010's Avatar
    Join Date
    07-04-2012
    Location
    Miami, United States
    MS-Off Ver
    Excel 365
    Posts
    762

    Re: VBA 64 bit Excel, difficulty opening a file

    The name of the program and a sample might be useful

  3. #3
    Registered User
    Join Date
    04-12-2014
    Location
    Thailand
    MS-Off Ver
    Excel 2013
    Posts
    3

    Re: VBA 64 bit Excel, difficulty opening a file

    The software is specialist unlikely anyone would have heard of it, but I have answered my own question..

    I put this up the top in the declarations

    #If VBA7 Then
    Private Declare PtrSafe Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _
    (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
    #Else
    Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _
    (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
    #End If
    and put this in my sub

    doc = "L:\A-LBA TOOL PROTOTYPE\OUTPUT1.GLB"
    ShellExecute 0&, vbNullString, doc, _
    vbNullString, vbNullString, vbNormalFocus
    and it works, don't ask me how, I am bluffing my way through this project

  4. #4
    Registered User
    Join Date
    04-12-2014
    Location
    Thailand
    MS-Off Ver
    Excel 2013
    Posts
    3

    Re: VBA 64 bit Excel, difficulty opening a file

    OK Ive not quite cracked it yet...

    Please Login or Register  to view this content.
    While the program does open with the file I want, the subroutine will not continue untill I have closed the program.

    As a sanity check I put in the MSgbox

    Once the program has opened I need to use the sendkeys command, but the msgbox does not appear unless I close the program.

    Any ideas?

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 2
    Last Post: 05-31-2014, 02:05 AM
  2. Replies: 4
    Last Post: 01-24-2012, 12:52 PM
  3. Difficulty opening excel
    By tsembroski in forum Excel General
    Replies: 0
    Last Post: 07-15-2011, 11:30 AM
  4. Difficulty opening Excel files
    By TomChuck in forum Excel General
    Replies: 1
    Last Post: 05-04-2005, 09:16 AM
  5. [SOLVED] Opening Excel Application difficulty
    By Ariston in forum Excel General
    Replies: 1
    Last Post: 02-19-2005, 10:06 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1