+ Reply to Thread
Results 1 to 3 of 3

Global delimiter setting?

  1. #1
    Registered User
    Join Date
    01-07-2008
    Posts
    38

    Global delimiter setting?

    I'm trying to find a setting that controls what Excel uses for delimiters in PasteSpecial, Import and Transpose. I'm running Excel 2011 under Mac OS X High Sierra.

    Here's my problem. I have a routine that pastes (using PasteSpecial) the clipboard into a worksheet. The clipboard has been copied from a text file that has two columns separated by a Tab character. It has been working correctly for months, placing the text in two worksheet columns. The code looks like:

    Please Login or Register  to view this content.
    Suddenly it started dropping the text into four columns, and of course all the subsequent routines that use the data failed.

    It turns out, the failures started after I used a Data > Text-to-Columns control on the ribbon to split something else, based on a hyphen delimiter. When I went back to pasting the clipboard, it was using the hyphen delimiter. The PasteSpecial has no way to change it, since it doesn't ask for a delimiter, even though Text-to-Columns and Import do.

    Side Note: the reason I'm using PasteSpecial from the clipboard instead of Import is that Excel 2011 does not allow the user or the developer to clear out the Data Connection created during an import. (Plus, the paste special appears to be faster.) This causes a warning message each time the workbook is opened - very annoying, and not something I want my users to experience.

    It appears that Text-to-Columns sets the very delimiter that Import and PasteSpecial also use. Is there anyplace other than using Text-to-Columns to control that delimiter?

    I have a workaround: run VBA's Range.TextToColumns method before each PasteSpecial to guarantee that my delimiter is exactly what I want.

    Please Login or Register  to view this content.
    This turns on the Tab but turns off the others. As I said, it's a workaround and I consider it clunky and kludgey, but it does the job I need.

    Is there a cleaner way to do this? Some basic delimiter setting that these methods use?

  2. #2
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,903

    Re: Global delimiter setting?

    That is the only way I know of to clear it. (It's a bit like the Find and/or Replace operation that remembers any settings used in the UI previously in that session)
    Rory

  3. #3
    Registered User
    Join Date
    01-07-2008
    Posts
    38

    Re: Global delimiter setting?

    Okay, thanks.
    I'll have to embed an explanation (apology) in the code's comments.
    cl

+ 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. Setting Global Variables
    By DanzaNZ in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-20-2018, 05:06 PM
  2. [SOLVED] Setting a Global Variable
    By manofcheese in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 06-12-2014, 12:24 PM
  3. Setting Default Delimiter when opening text files
    By EddieN1 in forum Excel General
    Replies: 2
    Last Post: 12-08-2013, 11:06 AM
  4. Setting Global Variables from UserForm
    By vikasnitk85 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-13-2012, 11:04 AM
  5. Setting Global Recal
    By nils.soderstrom in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 05-03-2010, 07:32 AM
  6. Setting a Global Variable
    By ChemistB in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 05-29-2008, 10:51 AM
  7. TextToColumns delimiter setting ignored w/in VB loop
    By Amy in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-15-2005, 06:45 PM

Tags for this Thread

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