+ Reply to Thread
Results 1 to 11 of 11

Test for Windows 7

  1. #1
    Registered User
    Join Date
    06-26-2008
    Location
    New Zealand
    Posts
    41

    Test for Windows 7

    I have Windows 7 and Excel 2007. This combination allows me to Save As to PDF using the following VBA code,

    Please Login or Register  to view this content.
    I found that Excel 2007 on XP doesn't allow Save as to PDF so I want to test for the Operating system type.

    I use this code,
    Please Login or Register  to view this content.
    but I think that's wrong. It is certainly giving me the wrong result.

    Is there a better way to test?
    Last edited by Rhapsodie; 09-03-2010 at 06:29 AM.

  2. #2
    Forum Expert Simon Lloyd's Avatar
    Join Date
    03-02-2004
    Location
    locked in the cage
    MS-Off Ver
    All the ones my homepage shows
    Posts
    3,161

    Re: Test for Windows 7

    You can find out the operating system with this:
    Please Login or Register  to view this content.
    Not all forums are the same - seek and you shall find

  3. #3
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: Test for Windows 7

    Rhapsodie, welcome to the forum. However, I'm afraid,

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here

  4. #4
    Registered User
    Join Date
    06-26-2008
    Location
    New Zealand
    Posts
    41

    Re: Test for Windows 7

    Just tried that snippet and I get the 'Can't find project or library compile error'. I used copy/paste of your code.
    Last edited by Rhapsodie; 09-03-2010 at 06:30 AM.

  5. #5
    Forum Expert Simon Lloyd's Avatar
    Join Date
    03-02-2004
    Location
    locked in the cage
    MS-Off Ver
    All the ones my homepage shows
    Posts
    3,161

    Re: Test for Windows 7

    Please comply with the moderators request i can then continue to help as per the forum rules.

  6. #6
    Registered User
    Join Date
    06-26-2008
    Location
    New Zealand
    Posts
    41

    Re: Test for Windows 7

    Sorry. I am using this test sub.

    Please Login or Register  to view this content.
    (I couldn't find any # anywhere so used the Quote icon).

    It fails the complile with the above error.
    Last edited by Rhapsodie; 09-03-2010 at 06:29 AM. Reason: changed quote tags to code tags

  7. #7
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: Test for Windows 7

    Rhapsodie,

    please edit your first post and add code tags before you post anything else.

    You can see the # command when you click Go Advanced after clicking the Edit button to edit a post.

    When you use the Quick Reply box, you won't see the # command, either. In this case, you can type [code]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/code] to add code tags, or click Go Advanced for the single click option.

    Thanks.
    Last edited by teylyn; 09-03-2010 at 06:24 AM.

  8. #8
    Forum Expert Simon Lloyd's Avatar
    Join Date
    03-02-2004
    Location
    locked in the cage
    MS-Off Ver
    All the ones my homepage shows
    Posts
    3,161

    Re: Test for Windows 7

    Use these [code]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/code], you didnt see the # because you used quick reply and the owners of this forum haven't seen fit to comply with requests from its members and staff and add it to the quick reply, you can overcome it by clicking Go Advanced (you need to edit your first post too, then i can help)

  9. #9
    Registered User
    Join Date
    06-26-2008
    Location
    New Zealand
    Posts
    41

    Re: Test for Windows 7

    Thanks for all the advise. I thought I was missing something. Is that post ok now?

  10. #10
    Forum Expert Simon Lloyd's Avatar
    Join Date
    03-02-2004
    Location
    locked in the cage
    MS-Off Ver
    All the ones my homepage shows
    Posts
    3,161

    Re: Test for Windows 7

    Sure
    You need to got the VBE (Alt+F11) and then click TOOLS>REFERENCES and make sure that you have:
    OLE Automations checked
    Visual Basic for Applications checked
    Microsoft Excel xx.0 Object Library checked (where xx.0 is your excels version i.e 14.0)
    Microsoft Office xx.0 Object Library checked (where xx.0 is your excels version i.e 14.0)

    Then run this and you should see all variables:
    Please Login or Register  to view this content.
    Last edited by Vaibhav; 04-14-2012 at 09:59 PM.

  11. #11
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Test for Windows 7

    FYI, the save to PDF is not OS specific. In Excel 2007 pre SP2, that function required an add-in that you could download from MS; if you have SP2 installed, it should be a native function.
    Remember what the dormouse said
    Feed your head

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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