Consulting

Results 1 to 5 of 5

Thread: Import data from excel to powerpoint(% not showing)

  1. #1
    VBAX Regular
    Joined
    Sep 2020
    Posts
    40
    Location

    Import data from excel to powerpoint(% not showing)

    Sir,
    I need some help.
    I want to import data from excel sheet which contains % ie 2%, 4%, .....( in column B)
    but when import to powerpoint through vba it display as 0.02, 0.04 (not in 2% or 4%).
    How it should display as 2% or 4%?


    tbhm = GetObject(filepath).sheets(1).Range("B2:B6")
    Application.Presentations(1).Slides(1).Shapes("Population").TextFrame.TextR ange.Text = tbhm(6, 1)

  2. #2
    tbhm = GetObject(filepath).sheets(1).Range("B2:B6")
    Application.Presentations(1).Slides(1).Shapes("Population").TextFrame.TextR ange.Text = FormatPercent(tbhm(6, 1))

  3. #3
    VBAX Regular
    Joined
    Sep 2020
    Posts
    40
    Location
    sir,
    After using
    Application.Presentations(1).Slides(1).Shapes("Population").TextFrame.TextR ange.Text = FormatPercent(tbhm(6, 1))

    it display 2% as 2.00% (not as 2% which I want)

    Is there any solution without changing below line but any changes in excel sheet may give the result I wanted ?

    tbhm = GetObject(filepath).sheets(1).Range("B2:B6")
    Application.Presentations(1).Slides(1).Shapes("Population").TextFrame.TextR ange.Text = tbhm(6, 1)


  4. #4
    you supply a 2nd parameter to the function. pass 0:

    Application.Presentations(1).Slides(1).Shapes("Population").TextFrame.TextR ange.Text = FormatPercent(tbhm(6, 1), 0)

  5. #5
    VBAX Regular
    Joined
    Sep 2020
    Posts
    40
    Location
    Thanks its working now.

    But is there any solution to change only in excel sheet ie in column/cell because in many case I import text/string so don't want edit in "tbhm(6, 1)".

Tags for this Thread

Posting Permissions

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